#1 Re: PDF Engine » DrawMeta is not drawing correct image. » 2025-03-24 09:52:30

I am bit stuck with the policy we have in order to share image/code etc.  but the thing is that when i am stretching he emf file in GDIPages , its not possible to draw a pixel perfect picture after 297*233 (approx) coordinate (mm). If i use TPDFDocument, everything is fine. just wondering if this is a known issue in TGDIPages.

#2 Re: PDF Engine » DrawMeta is not drawing correct image. » 2025-03-06 13:32:42

Hi, any suggestion to resolve this issue is highly appreciated.
thanks.

#3 PDF Engine » DrawMeta is not drawing correct image. » 2025-03-04 09:15:18

pjain
Replies: 3

Hi Everyone,
  I am using DrawMeta method of TGDIPages to Draw a metafile on pdf. I observed that the rendered pdf does not have a full graphic as in meta file. The problem become more interesting when it is not able to draw a part of image e.g. highlighted text, table cell border etc. Also, if i reduce the Rectangle size in which the image is drawn, then it prints it perfectly. but i would like to stretch it in a larger rectangle to completely utilise the A3 space for example.

When i Use DrawBMP, i can see a whole metafile is correctly rendered. The issue here is i need to use DrawMeta because i would like to have searchable text as well from the meta file. if i use DrawBMP, i am not able to search any text. The rectangle

Could you please suggest whats wrong here. or if i can try something else.

Note: My source metafile is of 1436*948 px. I am not sure how much i can stretch this on A3 Landscape print.

Thanks.

#4 Re: PDF Engine » Graphics are distorted when DrawMeta function is used in GDIPages » 2024-09-27 07:51:58

In the below picture, It can be seen that the grey header is not drawn until the end of page.

Capture.jpg

#5 PDF Engine » Graphics are distorted when DrawMeta function is used in GDIPages » 2024-09-10 10:07:46

pjain
Replies: 2

Hi,
   I am using GDIPages to print out a report  with graphics on each page. My data source is a list of meta file.
   When I am trying to use whole page space on either A3/A4 pages, my image is loosing colours . basically it looks like the text is there but the colours are gone.
   I have a doubt that if its an issue because of the graphic is stretched or something else. I am just using below code to draw the meta file in a specific rectangle.

   

      LPdfGDI.DrawMeta(R, TMetafile(AMetafilesList[i])); 
  

Thanks.

#6 Re: PDF Engine » Rendering issue of metafile in TGDIPages. » 2024-07-10 07:56:36

Could you please suggest which method to use, i tried using PrinterToMM but its giving me pretty small rectangle. Also i can see that inside DrawMeta, there is again mm to printer is used.

procedure TGDIPages.DrawMeta(rec: TRect; meta: TMetafile);
var old: Integer;
begin
  if Self=nil then exit; // avoid GPF
  CheckHeaderDone;
  rec := MmToPrinter(rec);
  old := SaveDC(fCanvas.Handle);   // ensure safe metafile embedding
  PlayEnhMetaFile(fCanvas.Handle, meta.Handle, rec);
  RestoreDC(fCanvas.Handle,old);
end;

#7 Re: PDF Engine » Rendering issue of metafile in TGDIPages. » 2024-07-09 08:57:52

Hi,

thanks for your reply.  I've changed the function a bit to make calculation a bit simpler for now. still the pdf doesnt look good.
It seems like the bitmap is streched a lot inside the rectangle.

would it be possible to change the interface so that DrawMeta accepts R in pixels just to do less calculations.

LPdfGDI := TGDIPages.Create(Self)
LPdfGDI.BeginDoc;
for I := 0 to AMetaFilesList.Count - 1 do
begin
    R.Left := 0;
    R.Right := TMetafile(AMetafilesList[i]).mmwidth ;
    R.Top := 0;
    R.Bottom := TMetafile(AMetafilesList[i]).height;
    LPdfGDI.DrawMeta(R, TMetafile(AMetafilesList[i]));
    LPdfGDI.NewPage;
end;
LPdfGDI.EndDoc;
LPdfGDI.ExportPDF('f:\gdipdf.pdf',false,false);
LPdfGDI.Free;

#8 PDF Engine » Rendering issue of metafile in TGDIPages. » 2024-07-04 13:33:30

pjain
Replies: 4

Hi,

I have a list of metafiles which i need to render in pdf file along with header and footer. for that purpose i am using TGDIPages. below is sample code i have
my meta file's width and height are : 1500 and 1000 respectively. Unfortunately the resolution of graphic in pdf is reduced to a very small size.

LPdfGDI := TGDIPages.Create(Self)
LPdfGDI.BeginDoc;
for I := 0 to AMetaFilesList.Count - 1 do
begin
    R.Left := LPdfGDI.PageMargins.Left;
    R.Right := TMetafile(AMetafilesList[i]).width - LPdfGDI.PageMargins.Right;
    R.Top := LPdfGDI.PageMargins.Top;
    R.Bottom := TMetafile(AMetafilesList[i]).height -LPdfGDI.PageMargins.Top;
    LPdfGDI.DrawMeta(R, TMetafile(AMetafilesList[i]));
    LPdfGDI.NewPage;
end;
LPdfGDI.EndDoc;
LPdfGDI.ExportPDF('f:\gdipdf.pdf',false,false);
LPdfGDI.Free;

Just wondering if anyone has faced similar issue and have any solution or other way to do this.

Thanks.

#10 PDF Engine » TGDIPages : How to add multiple pages in report » 2024-07-02 14:14:05

pjain
Replies: 2

Hi,
I've a list of metafiles and i would like to export these in a pdf . I am using TGDIPages to do that.
I also have header and footer to add to each page. I am not sure how can i generate multiple pages using TGDIPages. I've done similar with TPdfDocumentGDI but could not add header/footer hence using this.
Any help is apprciated. Thanks.

Board footer

Powered by FluxBB