merging two pdf files using gembox c# - c#-4.0

I need to merge to PDF files using Gem Box, is it possible to merge them with Gembox ?
I know that we can merge with ITEXT.Please suggest if there is a way to merge files with gembox.

EDIT 2019-11-15:
More appropriate solution for merging multiple PDF files into one is to instead use GemBox.Pdf, as shown in this example.
string[] files = { "File 1.pdf", "File 2.pdf", "File 3.pdf" };
using (var document = new PdfDocument())
{
foreach (var file in files)
using (var source = PdfDocument.Load(file))
document.Pages.Kids.AddClone(source.Pages);
document.Save("Merged Files.pdf");
}
EDIT 2017-11-22:
Newer version of GemBox.Document (version 2.5) supports PDF as both input and output file format, see the release post.
On the following link you can find the demonstration sample for "Read and Extract PDF Text in C# and VB.NET":
https://www.gemboxsoftware.com/document/examples/c-sharp-read-pdf/305
ORIGINAL ANSWER:
current version of GemBox.Document (version 2.3) only supports PDF files as an output files.
There is a feature request for this, but at this moment I'm not sure when it will be available:
https://support.gemboxsoftware.com/feedback/view/support-for-reading-pdf-files

Related

Reading xls file is returning html tags using library xlsx

I am using xlsx library of nodejs for reading xls file. According to the document the library supports xls file format. On reading I am getting html tags along with it.
I can remove the html tags using regex or replace function but does the library give support to do that as I couldn't find it in the documentation?
Excel File format: Microsoft Excel 97-2003 Worksheet (.xls)
The demo link they have provided in their documentation https://oss.sheetjs.com/sheetjs/ works but when I try to do the same with my code it doesn't give the desired result.
let xlsx = require('xlsx');
let fs = require('fs');
let workBookData = xlsx.readFile('data.xls'); // parses a file
console.log(workBookData);
Here is an image of the result I am getting.
This was an issue/bug in the library. A PR has been created for this and it will be fixed in the new version of the library.

laravel maatwebsite/excel download excel to pdf

how could i transform the file to pdf
i already tried change extension name but the image will disappear and excel format will shift
so is there any good idea can transform the file and at the same time could save the image and format?
here is my export code
my maatwebsite package does not have the create method.
public function export(Order $order)
{
return Excel::download(new OrderExport($order), $order->no.'.xlsx');
}
and the excel file will look like
excel file
if i transform it will be likeenter image description here
We had a similar problem but with word files.
We came to the conclusion that using the lowriter from LibreOffice will do the trick.
Option 1
In addition we used the use TitasGailius\Terminal\Terminal; library for easy Terminal use.
$export_path is the path where your excel file is
$file is the name of your file
$resp = Terminal::in($export_path)->run('lowriter --headless --convert-to pdf '.$file);
Option 2
Using some built in functionality of the Excel package.
Excel::create('Filename', function($excel) {
})->export('xls');
https://docs.laravel-excel.com/2.1/export/export.html

How to extract the zipped xls file from the email attachment?

I have a module which is supposed to extract the email attachment and place it at a specific location. The code creates the POP3 Client to fetch the mail and has been using EMAIL::MIME::Attachment::Stripper module to extract the attachment as below.
my $mail=$pop->HeadAndBody($i);
my $parsed = Email::MIME->new($mail);
my $stripper = Email::MIME::Attachment::Stripper->new($parsed);
my #attachments = $stripper->attachments;
foreach my $a(#attachments)
{
next if $a->{content_type} !~ /octet-stream/i;
my $f = new IO::File "C:/MAIL_PARSING_DATA/" . "<filename>.<file-extension>", "w" or die "Can not create file!";
print $f $a->{payload};
goto EXITPOINT;
}
The code is working fine for the standard files identified by the Perl module, like spreadsheet etc. But not for the specific mail which has a zipped Excel file as an attachment. While extracting the file the identified content_type by the Perl script for this file is application/octet-stream. While extracting the file using the above-mentioned code the file seems to be broken because:
The file is not getting opened through WinZip, WinRAR or 7-Zip.
File size for the file extracted through this script is slightly different than the same file extracted using Outlook.
Kindly provide some input on the issue.
The problem is here
next if $a->{content_type} !~ /octet-stream/i;
zip have content type as application/zip
#NeoNox, Thanks for the response. But the perl system identifies the file as octet-stream only, not with application/zip.
Anyways, I could find the solution.
I could resolve the problem by writing the file in the binary mode(mentioning explicitely as below:
binmode $fh;
Here the file is being writting in the binary mode So I don't get the output as the broken file.
I am finding the same issue.
XLSX files are not seen as attachments.
I am using IMAP.
It will download the email body, any jpgs or pngs etc but does not find the attached xlsx even when in an email that has attachments that are downloaded.

Perl reading XLSX embeded documents

First post here so if I am doing something stupid, please let me know.
CentOS 7(3.10.0-123.6.3.el7.x86_64), perl5 (revision 5 version 16 subversion 3), Spreadsheet::ParseXLSX v0.16
I have an .xlsx that has some embedded .pdf's and another xlsx in embedded within it. I am trying to read these and insert them into a csv along with the original xlsx. After some googl'ing to no avail my thought was to unzip the original xlsx and read the files from the xl/embeddings directory but, alas there is something with the file that causes adobe reader to not be able to read the oleObject(X).bin files in that dir.
I have been able to successfully read all the worksheets that dio not contain embedded docs using Spreadsheet::ParseXLSX, works great. I have googled for a solution but am either not using correct search prams or ...
If you know how to do this can you point me to some instructions?
TIA,
JohnM

SharePoint and Office Open XML interaction question

I've been frustrated by this for the entire weekend, plus a day or two, so any help would be significantly appreciated.
I'm trying to write a program that can programmatically go into a SharePoint 2007 doc library, open a file, change the contents of the file, then put the file back. I've gotten all but the last part of this down. The reason Office Open XML is involved is that that's how I'm opening the document and modifying it - through the Office Open XML SDK. My question is: How do I get it from the document back into the library?
The problem as I see it is that there's no save function on the WordprocessingDocument object itself. This prevents me from saving it into the SPFile's SaveBinary function.
You should use stream's to write back the changed OOXML into the SPFile.
I hope this example helps!
Stream fs = mySPFile.OpenBinaryStream();
using (WordprocessingDocument ooxmlDoc = WordprocessingDocument.Open(fs, true))
{
MainDocumentPart mainPart = wordDoc.MainDocumentPart;
XmlDocument xmlMainDocument = new XmlDocument();
xmlMainDocument.Load(mainPart.GetStream());
// change the contents of the ooxmlDoc / xmlMainDocument
Stream stream = mainPart.GetStream(FileMode.Open, FileAccess.ReadWrite);
xmlMainDocument.Save(stream);
// the stream should not be longer than the DocumentPart
stream.SetLength(stream.Position);
}
mySPFile.SaveBinary(fs);
fs.Dispose();
Yesterday I saw a webcast with Andrew Connell where he opened a doc from a doc library, added a watermark and saved the file again. It sure sounds like you should have a look at that webcast:
https://msevents.microsoft.com/CUI/WebCastRegistrationConfirmation.aspx?culture=en-US&RegistrationID=1299758384&Validate=false
btw I found that all 10 of the web casts in that serie were very good.

Resources