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

Conversion to tif or png

Thread ID:

Created:

Updated:

Platform:

Replies:

140779 Oct 12,2018 08:06 PM UTC Nov 9,2018 09:44 AM UTC Xamarin.Forms 14
loading
Tags: PdfViewer
Alain
Asked On October 12, 2018 08:09 PM UTC

Generally, the conversion from PDF to TIF or PNG is quite satisfactory.

I encountered a problem with one pdf file. It is a complex map with text and image overlays.
The attached pdf is displayed correctly in the syncfusion pdf viewer

However, when converted to tif or png using code such as the one posted here
https://www.syncfusion.com/kb/9112/how-to-convert-pdf-to-png
the resulting tif or png is quite different



Attachment: ErrDisplay_91b80197.zip

Karthikeyan Chandrasekar [Syncfusion]
Replied On October 17, 2018 12:20 PM UTC

Hi Alain, 
The reported issue is resolved while exporting the PDF pages as images by using the PdfViewercontrol with Pdfium rendering engine. 
Please find the below code snippet to export the PDF pages as images using PdfViewerControl with Pdfium rendering engine. From the essential studio version 16.3.0.21, the default rendering engine of PdfViewerControl is Pdfium. So, there is no need to set the rendering engine of PdfViewercontrol as Pdfium in sample level. 
PdfViewerControl pdfViewer = new PdfViewerControl(); 
pdfViewer.Load(@"ErrDisplay.pdf"); 
Bitmap image = pdfViewer.ExportAsImage(0); 
image.Save("Image.png", ImageFormat.Png); 

Please find the UG documentation link for exporting the PDF document as images using PdfViewerControl.
https://help.syncfusion.com/windowsforms/pdfviewer/working-with-pdf-viewer#exporting-pdf

 
Regards, 
Karthikeyan  


Alain
Replied On October 17, 2018 04:09 PM UTC

Thanks, this is better.

However, this is a bit confusing.
I understand the PDFViewerControl is using the pdfium rendering engine.
But it is not the case for PDFLoadedDocument ?

Karthikeyan Chandrasekar [Syncfusion]
Replied On October 18, 2018 05:12 AM UTC

Hi Alain, 
We use Pdfium only for rendering PDF document in our PDF Viewer, and we do not use is in PdfLoadedDocument. Please let us know if you need any further assistance in this. 

Regards, 
Karthikeyan 


Alain
Replied On October 18, 2018 01:10 PM UTC

Looks good. Case closed. Thank you !

Alain
Replied On October 18, 2018 03:50 PM UTC

Well, there is still a problem.
The viewer does not release the displayed file completely, I can't delete it.
So the following triggers an exception.

PdfViewerControl pdfViewer = new PdfViewerControl(); 
pdfViewer.Load(@"ErrDisplay.pdf"); 
pdfViewer.Dispose();

try
{
     IO.file.Delete(@"ErrDisplay.pdf")
}
catch (Exception ex)
{
     Debug.Print(ex.message);
}


However, if I use
pdfViewer.RenderingEngine = PdfRenderingEngine.SfPdf
there is no such problem.
there is no problem.


Karthikeyan Chandrasekar [Syncfusion]
Replied On October 19, 2018 05:37 AM UTC

Hi Alain, 
We are able to reproduce this issue and it is already fixed. This fix will be included in our upcoming 2018 Vol-3 SP1 release which is expected to be available in the end of October. 

Regards 
Karthikeyan 


Alain
Replied On October 31, 2018 09:52 PM UTC

I have installed the latest
Version : 16.3.0.29 (Service Pack)
Released on : Oct 30, 2018

Other issues I had seems OK now.

However this issue is still there.
using Syncfusion.Windows.Forms.PdfViewer;
PdfViewerControl pdfViewer = new PdfViewerControl(); 
pdfViewer.Load(@"ErrDisplay.pdf"); 
pdfViewer.Dispose();

try
{
     IO.file.Delete(@"ErrDisplay.pdf")
}
catch (Exception ex)
{
     Debug.Print(ex.message);
}

Karthik Krishnaraj [Syncfusion]
Replied On November 1, 2018 02:14 PM UTC

 
Hi Alian, 
 
We were unable to reproduce the issue. Here we could load and dispose the document properly. I have attached the sample and video for your reference. Can you please modify the sample to replicate the issue? It will be helpful for us to analyze further and provide better solution. 
 
Sample Link: 
 
Video Link: 
 
Regards, 
Karthik. 


Alain
Replied On November 2, 2018 02:03 PM UTC

Thanks, I tried your code snippet and it worked fine.


However, in your example

instead of
control.Load(@"D:\HTTP Succinctly.pdf");

use the following
control.Load(@"D:\HTTP Succinctly.pdf","");

This should trigger the exception.


Also, I tried with a pdf AES 256 rev B encrypted with the password X12345
and I used the following
control.Load(@"D:\HTTP Succinctly Encrypted X.pdf","X12345");

Should also trigger the exception, even if we provide a valid owner password !



Dilli Babu Nandha Gopal [Syncfusion]
Replied On November 5, 2018 03:42 PM UTC

Hi Alain,  
  
We are afraid that we are unable to reproduce the exception while loading the encrypted PDF document in our PDF viewer control Windows Forms platform. We suspect that the issue occurred with specific to the PDF document you are using in your end. So, we request you to provide the PDF document with which the issue could be reproduced.  
  
Note: If you have any confidential data in your PDF document, please replace with some dummy data and provide us the same. We just need your document to recreate the problem you face.  
  
Regards, 
Dilli babu. 


Alain
Replied On November 5, 2018 04:25 PM UTC

Hi, I don't believe it depends of the pdf

In the zip file, you will find pdftest.pdf

using Syncfusion.Windows.Forms.PdfViewer;
PdfViewerControl pdfViewer = new PdfViewerControl(); 

//pdfViewer.Load(@"pdftest.pdf");  //this is not raising an exception
pdfViewer.Load(@"pdftest.pdf","");  //when providing an empty password, it will raise the exception
//pdfViewer.Load(@"pdftest.pdf","alain");  //alain is the admin password, it will also raise the exception

try
{
     IO.file.Delete(@"pdftest.pdf");
}
catch (Exception ex)
{
     Debug.Print(ex.message);
}





Attachment: pdftest_beb8634c.zip

Balasubramanian Sundararajan [Syncfusion]
Replied On November 6, 2018 07:36 AM UTC

Hi Alain,   
 
Thank you for your update. 
   
Still we could not reproduce the exception while loading the encrypted PDF document in our PDF viewer control Windows Forms platform. Also we have created a simple sample to reproduce the reported exception with the PDF document attached by you in your previous update.  Can you please modify the sample to replicate the issue? It will be helpful for us to analyze further and provide better solution.  
 
 
Please let me know if you have any concern. 
 
Thanks, 
Balasubramanian S 


Alain
Replied On November 6, 2018 02:24 PM UTC

In form1.cs, use this instead

public Form1()

{

InitializeComponent();

pdfViewerControl1.Load("../../Data/pdftest.pdf", "alain");

pdfViewerControl1.Dispose(); //This is supposed to clear all resources used by the viewer.

System.IO.File.Delete("../../Data/pdftest.pdf"); //<--- This is raising an exception, the file pdfviewer.pdf is "used by another process"

}


Karthik Krishnaraj [Syncfusion]
Replied On November 9, 2018 09:44 AM UTC

Hi Alain, 
 
We have confirmed that the reported case is a defect from our side. We will include the fix for this issue in our Essential Studio Volume 4 release which will be rolled out in the month of December 2018. 
 
Regards, 
Karthik. 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

;