dynapdf question - programmatically set A6 paper size

this is my problem

the pdf has A6 size and the printer config has A4

i was studyng the example project “Print PDF” but i can’t PROGRAMMATICALLY configure the printer to match automatically the PDF SIZE

but i think i have a clue… to print a PDF i use the following code:

if pdf.PrintPDFFileWithDialog(nil, "doc name here",0,nil,nil,nil) = true then msgbox "ok" else msgbox "print cancelled" end if

works great. but the PDF is A6 and i don’t want to obligate the user to select A6 format manuallyi want to set the page size automatically.

i think that after the above code i could use something like this

dim p as DynaPDFPrintParamsMBS p.PageSize

but i don’t even have a clue of how to use it.

i know that instead nil… i have to use “p” in the corresponding pdf.PrintPDFFileWithDialog parameter

how do i set pagesize using DynaPDFPrintParamsMBS??

i have read the documentation but i don’t figure out how to do it

This is doomed to fail.

Why should you be able to do that?
Say the customer has a printer that only has A4 paper in it.
If you try and succeed to force A6, the printer will just stop and put up a message saying ‘insert A6 tray’ or similar.

You are creating a document.
if you want to print, ask the printer what paper size it is using, create a PDF of that size, and print that.

Otherwise, give the customer the document and let then decide how to print it.

thanks Jeff

i want to print A6 labels and then print A4 reports and then A6 labels… and so on, in the same printer. i don’t want to force users to manually change paper size many times

that will never be the case with any of my clients.

well, you can create a custom printer setup for Windows with WindowsDeviceModeMBS class:

[code]dim d as new WindowsDeviceModeMBS
dim name as string = “My printer”

d.Fields = d.DM_PAPERSIZE
d.PaperSize = d.DMPAPER_A6

dim data as string = d.RawData[/code]

Next you can pass that data to DynaPDFMBS.PrintSetDevMode(data as String) as Boolean method.

This may tell DynaPDF to use this printer setup.

[code]dim d as new WindowsDeviceModeMBS

d.Fields = d.DM_PAPERSIZE
d.PaperSize = d.DMPAPER_A6

dim data as string = d.RawData

if pdf.PrintSetDevMode(data) then
msgbox “ok”
msgbox “not set”
end if

if pdf.PrintPDFFileWithDialog(nil, “doc name here”,0,nil,nil,nil) = true then
msgbox “ok”
msgbox “print cancelled”
end if[/code]

this code does’t seem to work.
I’ve dived through the MBS documentation, but It seems like I can’t put the puzzle together

if i use

if pdf.PrintPDFFile(InputFile, "doc name here","HP LaserJet Professional P1606dn",0,nil,nil) = true then

doesn’t seem to work either

FWIW, I clarify that my printer has native support for A6 paper size

if i set number of copies… works perfect…

d.fields = d.DM_COPIES d.Copies = 8


d.Fields = d.DM_PAPERSIZE d.PaperSize = d.DMPAPER_A6

It doesn’t seem to work at all

Does it work with showing print dialog?
What settings are in device mode after dialog is used?