Multiple Page Invoices

Hi there,

First time asking help on the forums, as I am really bashing my head into this one. I feel this shouldn’t be that hard of an obstacle to overcome, but somehow I can’t get over it.

I am trying to create an invoice in PDF format using selectPDF (right now, I know that Blockspring also has an HTML to PDF converter) to convert a page called “invoice_page” into a PDF. So far, I have managed to set the background image to the letterhead of the invoice (and made it repeat vertically), and that converts neatly to an A4 PDF. But when I start adding stuff like repeating groups to start adding invoiced items, it just runs through the footer onto the next page and over the header of the next page.

Is there a way that I can create an invoice with multiple pages without it destroying the layout?

Regards,
Olrik

Not with the current integration. Right now, you’d have to build a layout on the page you’re using to generate the PDF that works on different list sizes, etc.

I see. Thanks for the information. I’ll try to work something out. If I do figure it out, I might put it into a tutorial, because I’ve seen multiple questions about it, but never a full solution.

Regards,
Olrik

1 Like

I’m having a similar issue. For me it’s very difficult to setup a page that works with different list sizes because the pdf I create can be one or multiple pages long depending on the input.

You can set the type of page which is nice, but I noticed that it doesnt take any page margins into account so I end up with a page that spills over onto the next page but there is no margin whatsoever. If someone needs to print this, some valuable information will get lost because the printer cant cope with that.

Would it be possible to set a margin or at least define a standard margin for each page size? This is probably a question for selectPDF though…

Looking at the selecpdf website, I guess it has something to do with this:

But no idea if that is something that the Bubble team would have to change…

Then there is also the page break html I could add, but I dont want to force an ‘always’ page break because sometimes there will be just one page.


This is the SelectPDF response to my email to them:

Hi,

HTML To PDF API - HTML To PDF Online REST API | SelectPdf.com

Please take a look at the ‘page setup’ section to see the margins parameters.

Regards,
SelectPdf Support
http://selectpdf.com

I noticed that the documentation mentions a default margin of 5pt but I dont think the current setup has this default in place.

Again, their response:

Hi,

Maybe the margins are set to 0 from the app you are using. You need to contact the developer of your app.

Perhaps someone from Bubble (@emmanuel :innocent:) can clarify that part?

Margins are set to 0 so that it shows your page.

Sorry, I dont understand. :frowning: To my knowledge, there are always margins because you do not want to have any text too close to the edge of the paper. That’s why there is a default margin of 5pt set by SelectPDF.

What do you mean by ‘so that it shows your page’? Would a 5pt margin not show the page? I setup my print page to be an A4 and if I know there is a 5pt margin, I can keep that into consideration.

A margin of 0 results in text too close to the edge and that gets lost when printing (yes, some of these will be printed unfortunately :P)

We call SelectPDF with margins 0. After that I can’t really know what they do with this number.

hmm, according to their documentation the default margin is 5pt:

margin_top, margin_right, margin_bottom, margin_left You can specify values for all 4 margins of the generated pdf document. The margins are specified in points. 1 point is 1 / 72 inch. By default all margins are 5pt.

Do you specifically call with a 0 margin? If you dont specify it would be 5pt?

Yes, as I said, we call selectpdf with this

margin_top: 0
margin_right: 0
margin_bottom: 0
margin_left: 0

Ok, so can you call without specifying the margin?

I cannot imagine anyone actually wanting a 0 margin on print pdf’s…

Just do this with your page… If you want some white space, do it with the page.

How do I add white space to a page that only gets created dynamically? I can setup one static page with extra white space all around, but I have multiple repeating groups that can have 0 (hidden) to dozens of lines thus creating additional page(s). Every new page should have a top and bottom margin but how do I set that if I don’t know where the page break will happen?

Yes that won’t work well with a variable number of pages unfortunately.

Would there be a use case for changing the 0 margins you call to the default SelectPDF margins?

Honestly we’ve had so much trouble with this plugin that i’m not sure we should change anything.

I had definitely hoped there would be a better alternative to SelectPDF from the start, but this is what’s available and at least it kind of works. So I feel you there, but on the other hand… for everyone who has pdf pages of which the height is set dynamically the pdf’s will look really weird without the top and bottom margins.

And in our case, the pdf will be basically useless because they need to be print ready.

I’ll add the option to change the margin.

3 Likes

That would be awesome.
If it is a lot of work or could potentially mess up things, I’d be happy to wait and see if I’m not the only one requesting this…

thanks!:smile_cat:

You changed it already! So awesome! Thanks a lot, pdf’s look great!

2 Likes

Hi there,

how did you setup your page to be DIN A4? Where did you specify the page size and what values did you use?
Thanks! :slight_smile: