Created
March 23, 2020 02:05
-
-
Save locofocos/362566f0119a68664a3da115aa2d2a80 to your computer and use it in GitHub Desktop.
Sweet Home 3D custom PDF page size snippet, the poor man's way
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in PageSetupPanel | |
public void updateController(PageSetupController controller) { | |
// ... | |
Paper paper = this.pageFormat.getPaper(); | |
float width = 45 * 72; // My desired width is 45 inches | |
float height = 30 * 72; // My desired height is 30 inches | |
// float theMargin = (float) ((1.0 / 10.0) * 72.0); // 1/10th of an inch | |
float theMargin = 0; // 0 inches | |
float paperTopMargin = theMargin; | |
float paperLeftMargin = theMargin; | |
float paperBottomMargin = theMargin; | |
float paperRightMargin = theMargin; | |
HomePrint homePrint = new HomePrint(paperOrientation, width, height, | |
paperTopMargin, paperLeftMargin, | |
paperBottomMargin, | |
paperRightMargin, | |
this.furniturePrintedCheckBox.isSelected(), | |
this.planPrintedCheckBox.isSelected(), | |
this.view3DPrintedCheckBox.isSelected(), | |
this.userPlanScaleRadioButton.isSelected() && this.userPlanScaleSpinner.getValue() != null | |
? 1f / ((Number)this.userPlanScaleSpinner.getValue()).intValue() | |
: null, | |
this.headerFormatTextField.getText().trim(), | |
this.footerFormatTextField.getText().trim()); | |
controller.setPrint(homePrint); | |
} | |
// in HomePrintableComponent | |
public static PageFormat getPageFormat(HomePrint homePrint) { | |
// ... | |
pageFormat.setPaper(paper); | |
// pageFormat = printerJob.validatePage(pageFormat); // comment out this line | |
return pageFormat; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Related forum discussion: http://www.sweethome3d.com/support/forum/viewthread_thread,7487_lastpage,yes#47089