1

I use PDF Clown to create PDF files containing text and different shapes. Saving the files brings the desired result. But when I print the pages or render them to bitmaps, only the shapes are visible and the text elements are missing.

I tried already different versions of the library with multiple files, always getting the same result.

Maybe someone can give me a hint on this issue.

EDIT:

This is a simplified form of the source code I use (with same result as described above; see the image at the end):

File file = new File();

Document document = file.Document;
document.PageSize = PageFormat.GetSize(PageFormat.SizeEnum.A4, PageFormat.OrientationEnum.Portrait);

Page page = new Page(document);
document.Pages.Add(page);

PrimitiveComposer composer = new PrimitiveComposer(page);


//draw a rectangle
composer.SetFillColor(DeviceRGBColor.Get(System.Drawing.Color.LightSalmon));
composer.DrawRectangle(new RectangleF(30, 42, 300, 32));
composer.Fill();


//draw some text
composer.SetFillColor(DeviceRGBColor.Get(System.Drawing.Color.Black));
composer.SetFont(new StandardType1Font(document, StandardType1Font.FamilyEnum.Courier, true, false), 32);
composer.ShowText("Hello World!", new PointF(32, 48));
composer.Flush();


//save the file
file.Save(@"..\document.pdf", SerializationModeEnum.Standard);


//and print it
Renderer renderer = new Renderer();
renderer.Print(file.Document, false);

Result of the above code (the printed version was created with virtual printer Adobe PDF; also tested with XPS Document Writer):

enter image description here

Exponent
  • 94
  • 5
  • 1
    You might want to share a sample to allow others to reproduce the issue. – mkl Nov 13 '16 at 19:54
  • Could it be, that text Rendering is not implemented yet at all? – Exponent Nov 14 '16 at 21:07
  • I tried the same using the Java version, and here not even the rectangle is rendered, I get a pure white page. So yes, rendering seems not yet to be properly implemented. – mkl Nov 15 '16 at 10:23

1 Answers1

4

(I don't have enough points to add a comment so I put this comment as an answer.) If you look in the source for the RenderingSample class, you will see this comment:

This sample demonstrates how to render a PDF page as a raster image. Note: rendering is currently in pre-alpha stage; therefore this sample is nothing but an initial stub (no assumption to work!).

I don't think Stephano Chizzolini got around to finishing it.

There is another NuGet download, PDFClown.Net version 2.0.0, by Matthieu. It has tags for PDF-To-Image, Rasterizer and PDF, but I have not been able to get it to work either. I cannot find documentation for it. Inspection of the properties for the downloaded NuGET assembly shows version 0.1.2.0 instead of 2.0.0.