Custom paper printing

Help is preferred to those who publish their work as Open Source and not as private branches rejecting collaboration. Such projects are not maintainable and shall be deleted.
Forum rules
This forum is personally pruned to avoid redundant posts. Related topics are grouped together. IF YOU HAVE REGISTERED, you need to send email to red1(a)red1.org with your username in the subject title to get me to activate you.

Custom paper printing

Postby chanls » Sun Feb 03, 2013 12:18 am

I create a print format to work with a custom paper size (Width: 206, Height: 102). Since "MediaSize" in "Print Paper" restricts (dimension X < dimension Y), I choose the "Landscape" option to keep the orientation (I cannot change the orientation of the paper in the printer because the printer is a dot matrix one).

Everything looks fine during the print preview. However when I print directly from Adempiere, all the print outs are rotated 90 degree. I can export the print out to a PDF and the printing works properly (need to choose "None" for "Page Scaling" and un-check "Auto Rotate and Center).

So it looks like Adempiere rotates the printing when the "Landscape" option is selected in the paper. How can I fix that (ask Adempiere not to rotate the print out)?

Thanks!


Nelson
chanls
 
Posts: 25
Joined: Wed Nov 02, 2011 10:33 pm

Re: Custom paper printing

Postby chanls » Sat Feb 23, 2013 6:30 am

Hi,

I found a solution (or a workaround) for my own problem.

I modified MPrintPaper.beforeSave() and added an "if" condition to check if a custom paper is used. If yes, skip the calling of "getMediaSize()". Here is the extract:

protected boolean beforeSave(boolean newRecord)
{
// Check all settings are correct by reload all data
m_mediaSize = null;

// Get the media size if custom paper is not used
if (!getCode().toLowerCase().startsWith("custom")) {
getMediaSize();
}

getCPaper();

return true;
}

After modifying the code, I am able to define the exact size of the paper installed in the printer (i.e., width > length) and the print out works perfectly.

I am able to skip the "getMediaSize()" for custom paper because the MediaSize is used to retrieve the paper size of standard paper while this is not necessary for custom paper (since the paper size is defined in the record).


Nelson Chan
chanls
 
Posts: 25
Joined: Wed Nov 02, 2011 10:33 pm


Return to HELP ME!!!

Who is online

Users browsing this forum: No registered users and 1 guest