facebooktwittermenuarrow-up

GemBox Support Forum

Adding PDF with images to empty document

Hi, when i concat a PDF with only images to a Gembox.Document, i get empty pages:

inputdoc = DocumentModel.Load(new MemoryStream(mybytearray), new GemBox.Document.PdfLoadOptions());
outputpdfdocument.Content.End.InsertRange(inputdoc.Content);

When I use a pdf with text, everything works fine.

When i try to load the pdf into Gembox.Pdf and then add it to document:

pdfin = GemBox.Pdf.PdfDocument.Load(new MemoryStream(mybytearray);
pdfin.SaveOptions.CrossReferenceType = PdfCrossReferenceType.Table;
var pdfStream = new MemoryStream();
pdfin.Save(pdfStream);
var document = DocumentModel.Load(pdfStream, LoadOptions.PdfDefault);
outputpdfdocument.Content.End.InsertRange(document.Content);

I get an exception at DocumentModel.Load, Input string is not in a correct format.

Regards, Danny

Hi Danny,

GemBox.Document is not intended for such a task.
It doesn’t support reading images from input PDF, see the following example:
Extract Text from PDF

GemBox.Document’s PDF reader never left the BETA stage.
It has limited usage, see the following help page:
Support level for reading PDF format (beta)

Anyway, can you tell us a bit more about your exact requirement, what are you trying to accomplish?
Do you want to include PDF content into a Word document or into some other PDF?

Last regarding the exception, I’m afraid that I was unable to reproduce this.
Can you save that pdfStream into a file and send it to us?

Regards,
Mario