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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

117781 Dec 11,2014 04:13 PM UTC Aug 6,2016 11:28 AM UTC Xamarin.Forms 4
loading
Tags: PDF
Ali Ben Zarrouk
Asked On December 11, 2014 04:13 PM UTC

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

Praveenkumar H [Syncfusion]
Replied On 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

Ali Ben Zarrouk
Replied On 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


Praveenkumar H [Syncfusion]
Replied On 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


Praveenkumar H [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;