Q: How do I render PDF to a bitmap with a non-uniform aspect ratio?
Our solution is to render the PDF to FixedPage and render it directory to WPF’s DrawingContext. Ideally your API would provide a PDFDraw.GetFixedPage(pageindex) method, but your latest version does not have that feature. The only way we can currently get a FixedPage is to convert PDF to XPS (pdftron.PDF.Convert.ToXps()).
A: With PDFDraw you can rasterize with non-uniform resolutions by setting ‘preserve aspect ratio’ in SetImageSize() to false. For example:
double dpi1 = 100, double dpi2 = 300,
draw.SetImageSize(dpi1 * 72, dpi2 * 72, false);
draw.GetBitmap();
the last parameter sets the ‘preserve aspect ratio’ to false.
Alternatively you could use PDFRasterize and render to a given bitmap with a custom affine matrix. This gives you more power (e.g. you can skew & rotate the page) but is a bit more tricky to use than PDFDraw.SetImageSize().
We could also expose a method to get a FixedPage, but there is no point since above method is more efficent and produces better output (since conversion from PDF to FixedPage could be lossy).