We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The printed paper seems to be A4, how do I set the paper size? This is my code, I have set the size of the PDF, but it will not affect the paper size.
`var printerName = "pdfFactory Pro";
var printFile = "D:\MyProject\Electron\electron-print\PDF\test04.pdf";
var pdfDocument = PdfDocument.Load(printFile);
var printDocument = pdfDocument.CreatePrintDocument();
var s = printDocument.PrinterSettings = new PrinterSettings() { PrinterName = printerName };
double pdfWidth = 40 / (25.4 / 100); double pdfHeight = 30 / (25.4 / 100); printDocument.DefaultPageSettings = new PageSettings() { Margins = new Margins(0, 0, 0, 0), PaperSize = new PaperSize("size", (int)pdfWidth, (int)pdfHeight) };
PaperSize updatedPaperSize = s.DefaultPageSettings.PaperSize; Console.WriteLine(updatedPaperSize.Height); printDocument.PrintController = new StandardPrintController(); printDocument.Print();`
I tried using PrinterSettings.PaperSizes sets the size of the printed paper, but this property is read-only and I cannot set it.
The text was updated successfully, but these errors were encountered:
设置纸张大小应该是printDocument.PageSettings.PaperSize
Sorry, something went wrong.
No branches or pull requests
The printed paper seems to be A4, how do I set the paper size?
This is my code, I have set the size of the PDF, but it will not affect the paper size.
`var printerName = "pdfFactory Pro";
var printFile = "D:\MyProject\Electron\electron-print\PDF\test04.pdf";
var pdfDocument = PdfDocument.Load(printFile);
var printDocument = pdfDocument.CreatePrintDocument();
var s = printDocument.PrinterSettings = new PrinterSettings()
{
PrinterName = printerName
};
double pdfWidth = 40 / (25.4 / 100);
double pdfHeight = 30 / (25.4 / 100);
printDocument.DefaultPageSettings = new PageSettings()
{
Margins = new Margins(0, 0, 0, 0),
PaperSize = new PaperSize("size", (int)pdfWidth, (int)pdfHeight)
};
PaperSize updatedPaperSize = s.DefaultPageSettings.PaperSize;
Console.WriteLine(updatedPaperSize.Height);
printDocument.PrintController = new StandardPrintController();
printDocument.Print();`
I tried using PrinterSettings.PaperSizes sets the size of the printed paper, but this property is read-only and I cannot set it.
The text was updated successfully, but these errors were encountered: