Hi all!
Some important facts about MigraDoc, PDFsharp, and PDF.
Let's start with MigraDoc- With MigraDoc, you create documents dynamically. At this stage, you have a document with sections, paragraphs, tables - but no pages. When the document is rendered to PDF, MigraDoc will create pages for you; when rendered to RTF, no pages are created until you use Word or another application to print the document; when rendering to HTML, you would get one file per section (rendering to HTML is currently not implemented).
- Questions like "I don't know how much space I have left on my page" make no sense with Migradoc because pages do not (yet) exist when you create the document.
- MigraDoc documents are highly dynamic, you can change anything at any time. You can add sections and tables. And finally you change the font size for style "Normal" from 10 to 14. MigraDoc adds the pagebreaks automatically when the document is rendered to PDF - and the table header will be repeated on every new page.
- MigraDoc can be used in a different way: you can measure anything you add to the document, you can add page breaks when needed, you can start a new table with every new page to get a different table header for each page. This can be done, but MigraDoc was not designed to be used this way.
About PDFsharp- PDFsharp cannot render PDF - not on the screen, not on a printer.
- PDFsharp cannot convert HTML or RTF to PDF (there is a third-party library on NuGet for HTML: "HTML Renderer for PDF using PdfSharp").
- PDFsharp cannot convert PDF to HTML or RTF.
Finally information about PDF- PDF is a vector format. There are no pixels in a PDF file, there is no DPI. You can add raster images to a PDF file - and those images will have pixels and there will be horizontal and vertical DPI values, but text and lines etc. do not have pixels.
- Dimensions are often specified in points. There are 72 points per inch. Point is just a unit, there are no pixels still. You can draw lines that are e.g. 0.5 or 0.25 points wide or even smaller. https://en.wikipedia.org/wiki/Point_(typography)
Some more information about Point vs. PixelThere are 72 points in an inch. Points are a unit that measures distances. Points are not pixels.
Pixel means picture element, the smallest part of a raster image.
If the image has 72 DPI (dots per inch) then you have one dot per point. Each pixel will be one point wide and one point high.
If the image has 216 DPI (dots per inch) then you have three dots (pixels) per point. Each pixel will be one-third point wide and one-third point high.
Let's say picture A is 300 pixel wide at 300 DPI. The size of this image is one inch or 72 points.
Let's say picture B is 300 pixel wide at 100 DPI. The size of this image is three inches or 216 points.
Picture A has 4.167 pixels per point, picture B has 1.389 pixels per point.
If the term point gets you on the wrong track then maybe think of inches or centimeters.
Not all image formats have a DPI setting and not all images have it set. PDFsharp and MigraDoc use a default value for images without DPI setting.