We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Losing PDF images in the original doc after adding an extra image

Hello,

I'm adding a page to an original PDF document.

After opening the PDF , adding a page to it and re saving , images on the original doc are gone.

Any clue about the problem ? And would turning the PDF to a jpg and re turning it to a PDF fix this ?

Thanks

4 Replies

PH Praveenkumar H Syncfusion Team December 15, 2014 03:52 AM UTC

Hi Ali,

Thank you for using syncfusion products,

Can you please provide us the input pdf document, it will help us to investigate further in this.

Please let us know if you need further assistance.

With Regards,
Praveen


AB Ali Ben Zarrouk December 16, 2014 01:24 PM UTC

Hi,

At the moment I cant send you PDF docs Im working with.

Im trying to find another solution and I think I did. I am converting the whole doc into list of bitmaps ( or jpg ) then back to PDF.

I tried converting the doc from jpg to PDFdoc and that doc was ok ( with images ) after processing it and adding a page to it.

So now Im looking for how to convert a PDFDoc to JPG (Or ideally BMP) On Xamarin.

I tried using Syncfusion.Windows.Forms.PdfViewer.PdfViewerControl  like in one of your samples but there's two problems :

1) I didnt find the assembly in the folder when I bought the Xamarin component , so I took one from one of your samples.
2) Error CS0012: The type `System.Windows.Forms.Control' is defined in an assembly that is not referenced. Consider adding a reference to assembly `System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

Can you please assist me in fixing this , converting pdf to List<Stream> ( images stream or any structure representing an image )

Thanks



PH Praveenkumar H Syncfusion Team December 18, 2014 04:04 AM UTC

Hi Ali,

Currently we don’t have support for PdfViewerControl in xamarin platform, we have logged the feature request internally, and we will update you once it has been implemented.

With Regards,

Praveen



PH Praveenkumar H Syncfusion Team December 18, 2014 04:45 AM UTC


Hi Ali,


We are not able to reproduce the issue in our side and we have attached sample project for your reference. Please try the sample and let us know the result.

1. Please find the code snippet to add the page in existing document.


Stream xmlStream = typeof(mainPage).GetTypeInfo().Assembly.GetManifestResourceStream("GettingStarted.Barcode.pdf");


PdfLoadedDocument document = new PdfLoadedDocument(xmlStream);


 


PdfLoadedPage page = document.Pages.Add() as PdfLoadedPage;


//Saves the document.


MemoryStream stream = new MemoryStream();


document.Save(stream);

2. We can import the page form the existing document instead of converting the whole document to image please find the code snippet.


Stream xmlStream = typeof(mainPage).GetTypeInfo().Assembly.GetManifestResourceStream("GettingStarted.Barcode.pdf");


PdfLoadedDocument document = new PdfLoadedDocument(xmlStream);


PdfDocument doc = new PdfDocument();


doc.ImportPageRange(document, 0, document.PageCount-1);


 


doc.Pages.Add();


 


//Saves the document.


MemoryStream stream = new MemoryStream();


doc.Save(stream);


 


Please try this workaround on your document and let us know the result, please send us your input document to investigate further in this.


With Regards,


Praveen



Attachment: GettingStarted_bc8c65a5.zip

Loader.
Up arrow icon