1

Adding a QR code as a bitmap to an ABCPDF document:

Doc pdf = new Doc();
pdf.Rendering.AntiAliasImages = false;
...
pdf.AddImageBitmap(bmp, true);

When rendered to a PDF file the image appears anti-aliased:

enter image description here

When printed direct to a printer the same the QR code is fine:

enter image description here

My question is: what am I doing wrong?

  • It looks like it's getting resized. I don't have much experience with AbcPDF doing direct build of a PDF like that (I render HTML into reports with it), but you might look at trying to keep it from getting resized. – Moose Dec 14 '18 at 16:02

1 Answers1

1

You need to size Doc.Rect based on the image size and resolution e.g.

// Set PDF image size from image size and resolution (PDF coord space is 72dpi)
doc.Rect.Height = bmp.Height * 72 / bmp.VerticalResolution;
doc.Rect.Width = bmp.Width * 72 / bmp.HorizontalResolution;
doc.AddImageBitmap(bmp, true);

(And the Rendering class properties only apply when exporting from a PDF to an image.)

overprint
  • 31
  • 1
  • 4