Error in generating image from pdf.
Posted: Mon Nov 16, 2015 8:57 pm
Hello There,
We are using GDPicture to generate and save as JPEG from pdf. one of our pdf files that we get from external source is not able the generate the image from pdf using gd picture. The code is given below and the pdf is attached.
GdPicturePDF _gdPicturePdf = new GdPicturePDF();
GdPictureStatus status = _gdPicturePdf.LoadFromFile(filePathtextBox.Text, true);
if (_gdPicturePdf.GetPageCount() > 0)
{
using (GdPictureImaging gdPictureImaging = new GdPictureImaging())
{
int imageId = 0;
status = _gdPicturePdf.SelectPage(1);
_gdPicturePdf.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitPoint);
VerifyStatus(status, "Failed to select first page in Pdf document.");
imageId = _gdPicturePdf.RenderPageToGdPictureImage(96.0f, false);
gdPictureImaging.SaveAsJPEG(imageId, _tempOutputFile);
if (_gdPicturePdf != null)
{
VerifyStatus(_gdPicturePdf.GetStat(), "Failed to save image to jpeg.");
}
imagepanel.BackgroundImage = System.Drawing.Image.FromFile(_tempOutputFile);
}
}
Thanks,
Kamal.
We are using GDPicture to generate and save as JPEG from pdf. one of our pdf files that we get from external source is not able the generate the image from pdf using gd picture. The code is given below and the pdf is attached.
GdPicturePDF _gdPicturePdf = new GdPicturePDF();
GdPictureStatus status = _gdPicturePdf.LoadFromFile(filePathtextBox.Text, true);
if (_gdPicturePdf.GetPageCount() > 0)
{
using (GdPictureImaging gdPictureImaging = new GdPictureImaging())
{
int imageId = 0;
status = _gdPicturePdf.SelectPage(1);
_gdPicturePdf.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitPoint);
VerifyStatus(status, "Failed to select first page in Pdf document.");
imageId = _gdPicturePdf.RenderPageToGdPictureImage(96.0f, false);
gdPictureImaging.SaveAsJPEG(imageId, _tempOutputFile);
if (_gdPicturePdf != null)
{
VerifyStatus(_gdPicturePdf.GetStat(), "Failed to save image to jpeg.");
}
imagepanel.BackgroundImage = System.Drawing.Image.FromFile(_tempOutputFile);
}
}
Thanks,
Kamal.