T O P I C R E V I E W |
jenswahl |
Posted - Feb 26 2018 : 08:30:04 Hello,
I get a Bitmap from a PDF-page and can it save without ImageEn as Bitmap in a good result. Using ImageEnView (to save it in another format) brings partial error-images:
//This works fine:
//(The result of PdfView1.RenderPage is a Bitmap, created from the displayed PDF-page)
procedure SaveToBitmap;
var
Bitmap: TBitmap;
begin
Bitmap := PdfView1.RenderPage(0, 0, PdfView1.Width, PdfView1.Height, ro0, PdfView1.Options);
//allow only bmp-Filter:
if SaveImageEnDialog1.Execute then begin
try
Bitmap.SaveToFile(SaveImageEnDialog1.FileName);
finally
Bitmap.Free;
end;
end;
end;
This ends in a B/W-image on saving as PNG- or BMP-File; Jpg is OK:
procedure SaveBitmap(Sender: TObject);
var
sExt: String;
begin
//ievPDF is TImageEnView; LegacyBitmap has no influence
ievPDF.Bitmap.Assign(PdfView1.RenderPage(0, 0, PdfView1.Width, PdfView1.Height, ro0, PdfView1.Options));
//here looks still OK:
ievPDF.Update;
if SaveImageEnDialog1.Execute then begin
//nothing:
// sExt := Lowercase(ExtractFileExt(SaveImageEnDialog1.FileName));
// if (sExt = '.png') then begin
// ievPDF.IO.Params.PNG_Filter := ioPNG_FILTER_ALL; //ioPNG_FILTER_NONE; // ioPNG_FILTER_PAETH;
// ievPDF.IO.Params.PNG_Compression := 5;
// end;
try
//nothing ievPDF.RemoveAlphaChannel;
ievPDF.IO.SaveToFile(SaveImageEnDialog1.FileName);
finally
ievPDF.Blank;
end;
end;
end;
What is the reason for it? I'm using IE 7.5.0.
Kind regards, Jens |
5 L A T E S T R E P L I E S (Newest First) |
jenswahl |
Posted - Feb 28 2018 : 02:43:18 Hello Nigel,
the SaveToStream/LoadFromStream ends with a gray Png- or Jpg-file, you can not see any text or image. So I believe that the streamed bitmap is corrupt. Thank you for your help. I will keep the version to save the bitmap to a file and load it to ImageEnView. This works.
Jens |
jenswahl |
Posted - Feb 28 2018 : 01:42:10 Hello Nigel,
yes, I tried a lot of variants, also the following:
Bitmap := PdfView1.RenderPage(0, 0, PdfView1.Width, PdfView1.Height, ro0, PdfView1.Options);
ievPDF.Bitmap.Assign(Bitmap);
//also ievPDF.IEBitmap.Assign(Bitmap);
Every time the same result: Jpg OK, Png and Bmp are only B/W-images with a raster. Different settings with IOParams: The same result. What I saw: in the SaveImageEnDialog the preview is only available for B/W (Bitmap and Png) and only for the result, not for the source image. If I want to save as Jpg I have a (colored) preview also for 16M (for instance), see the attached images.
The idea with the stream is good, I will try it. Thank you.
Jens




 |
xequte |
Posted - Feb 27 2018 : 13:40:36 Hi Jens
Even if you assign the temporary bitmap to the TIEBitmap it fails?
You could also save/load from a stream rather than a temp file...
Nigel Xequte Software www.imageen.com
|
jenswahl |
Posted - Feb 27 2018 : 02:31:31 Thank you for the suggestions but nothing solved the problem. The Params, Pixelformat and Bitcount seemed to be OK. But I got no Preview for Bmp or Png on SaveImageEnDialog - only for B/W-images. I believe that the rendered PDF page is a corrupted Bmp.
So I'm using a workaround: Create a Bitmap from the rendered PDF page and save it to a temporarily file. Than load it using ImageEnView and I can save in all formats without a problem.
Jens |
xequte |
Posted - Feb 26 2018 : 14:36:42 Hi
You should not use TImageEnView.Bitmap, rather use TImageEnView.IEBitmap.
Does it work with: ievPDF.LegacyBitmap := False; ievPDF.IEBitmap.Assign(PdfView1.RenderPage(0, 0, PdfView1.Width, PdfView1.Height, ro0, PdfView1.Options));
If the colors are not right, check the value of ievPDF.IEBitmap.PixekFormat, and relevant format properties, such as TIFF_Compression:
https://www.imageen.com/help/TIOParams.html
Nigel Xequte Software www.imageen.com |
|
|