#1 Re: PDF Engine » Rendering Meta File making border lines thicker » 2016-05-18 18:31:43

After trying to solve this problem for almost a week, I figured out what was causing the issue of thicker lines in PDF. Don't know if it's the best solution, but for what i've tested here, everything is ok.

In the lines where it calculates Result.Right and Result.Bottom, there was a '-1' being passed to I2X and I2Y. Example: result.Right := I2X(Rect.Right - 1). When i took it off, worked like a charm.

Here is the new code:

In the function TPdfCanvas.RectI(Rect: TRect; Normalize: boolean): TPdfRect;
begin
  result.Left := I2X(Rect.Left);
  result.Right := I2X(Rect.Right);
  result.Top := I2Y(Rect.Top);
  result.Bottom := I2Y(Rect.Bottom);
  if Normalize then
    NormalizeRect(result);
end;

Would it cause some trouble?

Thanks

#2 Re: PDF Engine » Rendering Meta File making border lines thicker » 2016-05-05 19:45:16

Here is how I call the renderer. fMyDocPDF is the TPDFDocumentGDI.

procedure TRLPDFFilter.InternalDrawPage(APage: TRLGraphicSurface);
var mf: TMetaFile;
    mfc: TMetaFileCanvas;
begin
   mf := TMetaFile.Create;
   Try
      mfc := TMetafileCanvas.Create(mf, 0);
      Try
         apage.PaintTo(mfc, Rect(0, 0, apage.Width, apage.Height));
      Finally
         FreeAndNil(mfc);
      end;

      fMyDocPDF.DefaultPageLandscape := aPage.Orientation = MetaOrientationLandscape;
      fMyDocPDF.AddPage; // add a page with a metafile on it
      fMyDocPDF.Canvas.RenderMetaFile(mf); 
   Finally
      FreeAndNil(mf);
   end;

#3 PDF Engine » Rendering Meta File making border lines thicker » 2016-05-05 19:40:42

FernandoSYSRS
Replies: 3

Hello!

I see some people are having similar problems about rendering meta file in SynPDF. I just updated from version 1.14 to 1.18. Here is what is happening with me:

As I open the generated PDF from SynPDF, i realize border lines are thicker than expected. I visited some topics here, related to this issue, but none was helpful.[topic]synopse.info/forum/viewtopic.php?id=301[/topic]
[topic]synopse.info/forum/viewtopic.php?id=1607[/topic]
[topic]synopse.info/forum/viewtopic.php?id=2892[/topic]

Here is how Fortes generates it:
e9QxLG.jpg

And how SynPDF does:
iqn64m.jpg

As suggested by the Administrator, I've downloaded EMFExplorer. So we could have a clue about what to do. The thing is: Using EMFExplorer, it is exactly like Fortes Report. I guess there is something with SynPDF, but I could not find anything that might be the problem.

If we select the option "EMF as Text" in EMFExplorer, we'll get this:

R0001: [001] EMR_HEADER	(s=108)	{{ Bounds(38,38,755,55), Frame(0,0,56400,31800), ver(0x10000), size(1636), recs(46), handles(6), pals(0), dev_pix(1600,900), dev_mil(564,318), pixf_size(0), pixf_ofs(0), openGL(0) }}
R0002: [027] EMR_MOVETOEX	(s=16)	{ ptl(0,0)}
R0003: [082] EMR_EXTCREATEFONTINDIRECTW	(s=368)	{ihFont(1) ELF[name() style() vendor(0x00000000)] LOG[face(Tahoma), style(), charset(1),family(0),precision(0), height(-11), width(0)]}
R0004: [037] EMR_SELECTOBJECT	(s=12)	{Table object: 1=OBJ_FONT}
R0005: [024] EMR_SETTEXTCOLOR	(s=12)	{0x00000000}
R0006: [038] EMR_CREATEPEN	(s=28)	{ihPen(2), style(0=PS_SOLID | COSMETIC), width(1), color(0x00000000)}
R0007: [037] EMR_SELECTOBJECT	(s=12)	{Table object: 2=OBJ_PEN.(PS_SOLID | COSMETIC)}
R0008: [020] EMR_SETROP2	(s=12)	{iMode(13=R2_COPYPEN)}
R0009: [039] EMR_CREATEBRUSHINDIRECT	(s=24)	{ihBrush(3), style(0=BS_SOLID, color:0x00FFFFFF)}
R0010: [037] EMR_SELECTOBJECT	(s=12)	{Table object: 3=OBJ_BRUSH.(BS_SOLID)}
R0011: [025] EMR_SETBKCOLOR	(s=12)	{0x00FFFFFF}
R0012: [018] EMR_SETBKMODE	(s=12)	{iMode(2=OPAQUE)}
R0013: [075] EMR_EXTSELECTCLIPRGN	(s=16)	{iMode(5=RGN_COPY), RGNDATA[ptr:0x03cd0284, size:0, box()]}
R0014: [030] EMR_INTERSECTCLIPRECT	(s=24)	{rclClip(0,0,794,1123)}
R0015: [075] EMR_EXTSELECTCLIPRGN	(s=16)	{iMode(5=RGN_COPY), RGNDATA[ptr:0x03cd02ac, size:0, box()]}
R0016: [030] EMR_INTERSECTCLIPRECT	(s=24)	{rclClip(38,38,756,56)}
R0017: [037] EMR_SELECTOBJECT	(s=12)	{Stock object: 5=OBJ_BRUSH.(BS_NULL)}
R0018: [039] EMR_CREATEBRUSHINDIRECT	(s=24)	{ihBrush(4), style(0=BS_SOLID, color:0x00000000)}
R0019: [037] EMR_SELECTOBJECT	(s=12)	{Table object: 4=OBJ_BRUSH.(BS_SOLID)}
R0020: [025] EMR_SETBKCOLOR	(s=12)	{0x00000000}
R0021: [018] EMR_SETBKMODE	(s=12)	{iMode(2=OPAQUE)}
R0022: [043] EMR_RECTANGLE	(s=24)	{Box(38,38,38,55)}
R0023: [043] EMR_RECTANGLE	(s=24)	{Box(38,38,755,38)}
R0024: [043] EMR_RECTANGLE	(s=24)	{Box(755,38,755,55)}
R0025: [043] EMR_RECTANGLE	(s=24)	{Box(38,55,755,55)}
R0026: [075] EMR_EXTSELECTCLIPRGN	(s=16)	{iMode(5=RGN_COPY), RGNDATA[ptr:0x03cd037c, size:0, box()]}
R0027: [030] EMR_INTERSECTCLIPRECT	(s=24)	{rclClip(0,0,794,1123)}
R0028: [075] EMR_EXTSELECTCLIPRGN	(s=16)	{iMode(5=RGN_COPY), RGNDATA[ptr:0x03cd03a4, size:0, box()]}
R0029: [030] EMR_INTERSECTCLIPRECT	(s=24)	{rclClip(38,38,756,56)}
R0030: [037] EMR_SELECTOBJECT	(s=12)	{Stock object: 5=OBJ_BRUSH.(BS_NULL)}
R0031: [037] EMR_SELECTOBJECT	(s=12)	{Stock object: 13=OBJ_FONT}
R0032: [082] EMR_EXTCREATEFONTINDIRECTW	(s=368)	{ihFont(5) ELF[name() style() vendor(0x00000000)] LOG[face(Tahoma), style(), charset(1),family(0),precision(0), height(-13), width(0)]}
R0033: [037] EMR_SELECTOBJECT	(s=12)	{Table object: 5=OBJ_FONT}
R0034: [024] EMR_SETTEXTCOLOR	(s=12)	{0x00000000}
R0035: [037] EMR_SELECTOBJECT	(s=12)	{Stock object: 5=OBJ_BRUSH.(BS_NULL)}
R0036: [025] EMR_SETBKCOLOR	(s=12)	{0xFF000000}
R0037: [018] EMR_SETBKMODE	(s=12)	{iMode(1=TRANSPARENT)}
R0038: [084] EMR_EXTTEXTOUTW	(s=100)	{ TXT=[test] [exScale(35.250000) eyScale(35.333332) iGraphicsMode(1), Bounds(41,39,61,54)] TxOPT[fOptions(0), nChars(4), offDx(84), ptlRef(41,39), rcl(0,0,-1,-1)] Spacing[4,7,6,4 => Total(21) =>xPtRefRight(61)]}
R0039: [027] EMR_MOVETOEX	(s=16)	{ ptl(62,39)}
R0040: [075] EMR_EXTSELECTCLIPRGN	(s=16)	{iMode(5=RGN_COPY), RGNDATA[ptr:0x03cd0604, size:0, box()]}
R0041: [030] EMR_INTERSECTCLIPRECT	(s=24)	{rclClip(0,0,794,1123)}
R0042: [075] EMR_EXTSELECTCLIPRGN	(s=16)	{iMode(5=RGN_COPY), RGNDATA[ptr:0x03cd062c, size:0, box()]}
R0043: [037] EMR_SELECTOBJECT	(s=12)	{Stock object: 7=OBJ_PEN.(PS_SOLID | COSMETIC)}
R0044: [037] EMR_SELECTOBJECT	(s=12)	{Stock object: 5=OBJ_BRUSH.(BS_NULL)}
R0045: [037] EMR_SELECTOBJECT	(s=12)	{Stock object: 13=OBJ_FONT}
R0046: [014] EMR_EOF	(s=20)	{nPalEntries:0, offPalEntries:16, nSizeLast:20}

If someone wants my Meta File, i'll send by email, or post here anyway.

I'm exporting PDFs through Fortes Report on Delphi XE2.

Board footer

Powered by FluxBB