5
I have the following code:
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(arquivoImpressao);
pd.DefaultPageSettings.PaperSize = new PaperSize("teste", 300, 600);
PrintPreviewDialog printPrvDlg2 = new PrintPreviewDialog();
((Form)printPrvDlg2).WindowState = FormWindowState.Maximized;
printPrvDlg2.Document = pd;
printPrvDlg2.ShowDialog();
printDocument.DocumentName = descricao;
pd.Print();
When he opens the PrintPreviewDialog, it shows correctly on the image, but when it prints on the PDF printer ("Microsoft Print to PDF"), it generates in the size of the A4. Where am I going wrong?
I did a test in Word and made a change in the paper size, when it was generated, the paper was according to the size stipulated in Word, in case, I believe the problem is even in C#.
I added this element, but is giving error, Rawkind does not accept this value, because they are different values
– HimorriveL
The documentation of Rawkind says that for custom sheet should be used an integer larger than 118. I will make the change.
– Augusto Vasques