Create a page map in DynaPDF

I have DynaPDFMBS (starter edition) which (until now) has handled 99% of all my PDF needs.
My app generates printed output, where several pages form a larger ‘whole’

I have just added a feature to the printing aspect of my app , which generates a ‘page map’
9,10,11… etc

The page map is a grid of thumbnail views of the pages, and I grab each thumbnail at the point that I generate the pages for print into an array.

Rather like this:

I now would like to do the same with the PDF output.
I know that DynaPDFMBS has a rendering engine, but this requires the Pro edition, which is a huge leap in licence fee that I can’t justify for this.

Does anyone have an idea that would allow me to grab the pages as I add them to the PDF, and render them in miniature or as thumbnail images later into a final page?

Mac? Because there we also have PDFKit functions available to render.

Mac and Windows, sadly.
If its ‘easy’ in PDFKit then I’ll have it as a Mac-only feature , but I would prefer cross platform…

Maybe consider upgrading plugins?

After some thought, I have bought into the Pro edition of the MBS DynaPDF plugins to get my hands on RenderPDF and similar functions.
So now I just need to work out the best way to do this. :wink:

Has anyone done something like this before - any tips?

RenderPagePicture(PageNum as integer, Width as integer, Height as Integer, DefScale as integer = 2, matrix as DynapdfMatrixMBS = nil) as picture

may work there.
When you have PDF in memory, you can just ask for pictures for pages in a given size.

Looking good so far.

I’m using

for x = 1 to pdf.GetPageCount pages2.append pdf.RenderPagePicture(x , pdf.GetPageWidth /2 , pdf.GetPageHeight/2 ,2) next

to get myself an array of images which are (roughly) 480 x 550 representations of A4 sheets.

I should have this wrapped up today at this rate, so I think that’s money well spent. :slight_smile:

Job complete.

My code wouldnt help many other’s doing the same thing, but the method was this:

Assemble an array of images, one per page.
because my needs are pages that represent sections of a larger image, I have X pages across and Y pages down.

I get the size of x * thumbnailwidth by y * thumbnailheight
This could be portrait or landscape shape, butthe page itself could be portrait or landscape

So the next step is to see how much I have to shrink by to make my shape fit, even if that means a big gap at the edges.
Some funky maths might do it, but I started with a ratio of 4,
and used a while loop to reduce that by 0.1 until both the height and the width of the (area I need) * ratio
fit inside the PDF boundaries.

I might end up with a ratio of 0.6, for example. This means my thumbnails are a little too big and will need to be drawn smaller to the PDF.

I fill the PDF page with a grey rectangle.
I work out how wide x pages * thumbnailwidth * ratio is (this is less than the page width)
Then subtract that width from the PDF width, and divide by 2 … (this gives an X start position which will allow equal margins L&R)
Repeat for the heights.

Then in an x,y loop, insertpicture into the pdf page.

If I was aiming for the above, I might add dark shadow lines to the right and below each picture.

Now I can read up and see what other goodies the Pro edition gives me… :wink: