LDraw.org Discussion Forums
LPub3D - Request - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html)
+--- Forum: LDraw File Processing and Conversion (https://forums.ldraw.org/forum-22.html)
+--- Thread: LPub3D - Request (/thread-21919.html)

Pages: 1 2


LPub3D - Request - Kevin - 2016-11-22

Trevor,

When printing to a PDF file, would it be possible to make the background color/image a background layer in PDF that could be suppressed when actually printing a hardcopy?

Also, I recently noticed that when using the A4 page size in landscape mode, there was a thin white band at the right edge of the generated PDF pages.  This band went away when I chose a Custom page size of 8.27 x 11.7 inches instead of LPub3D's default of 8.3 x 11.7 for A4. 

Thanks!

Kevin


RE: LPub3D - Request - Merlijn Wissink - 2016-11-23

I think I saw that tiny white band on landscape pages too, I thought my image was too small or something.
But because I went for white pages backgrounds in the end anyway, I didn't take a closer look at it.


RE: LPub3D - Request - Trevor Sandy - 2016-11-24

(2016-11-22, 16:43)Kevin Wrote: When printing to a PDF file, would it be possible to make the background color/image a background layer in PDF that could be suppressed when actually printing a hardcopy?

Kevin, It is possible to suppress the document background (set to transparent at printing). However, I'm not sure I well understand how you expect to print a pdf hardcopy. At this moment, it is not possible to print a hardcopy directly from LPub3D - this is by design, actually the code is already in place, I have just not enabled it. Considering the current status of LPub3D, are you suggesting to print a hardcopy from a third party application (e.g. Acrobat or Acrobat Reader...) ? If yes, I'm not sure how I can force a third party application to suppress printing the background. However, Acrobat does offer the ability to remove the background of your pdf document. Perhaps this can be a workable solution to your request if you expect to print from a third party application.

With LPub3D, I can offer to suppress the background as an option when exporting to pdf - or any output for that matter.

Let me know if what you envision is different from what I have described here ?

(2016-11-22, 16:43)Kevin Wrote: I recently noticed that when using the A4 page size in landscape mode, there was a thin white band at the right edge of the generated PDF pages.  This band went away when I chose a Custom page size of 8.27 x 11.7 inches instead of LPub3D's default of 8.3 x 11.7 for A4. 

Indeed, this is a known issue coming from LPub. Despite my efforts, I have not been able to completely solve it. Kevin Clague best summarizes the issue in his code comment:

/* There are issues with printing to PDF and its fixed page sizes, and
* LPub's arbitrary page size controls. So when printing, we have to
* pick a PDF page size that is closest but not smaller than the size
* defined by the user, and then fill that page's background to the
* edges. The code below gets most of this done (the print caller
* maps LPub page size to PDF page size and sets view size, so we
* work with that here.
*
* There still seem to be cases where we get little gaps on either the
* right or bottom edge, and I just don't know what the problem is.
*/

I think it is linked to the conversion between pixels, mm and in - inches are exclusively used by the print engine to get the right DPI value.

Cheers,


RE: LPub3D - Request - Kevin - 2016-11-24

Trevor,

Thanks for the response.  Yes, I'm talking about printing from a 3rd-party application after the PDF has been generated.  If the PDF document generated by LPub3D identifies the background (color, image, gradient) as a background layer, then Acrobat Reader (and probably other apps) can suppress printing it.  The actual content of the page would be in another layer.

I tried setting the background to "transparent" but it appears that LPub3D generates a white background for the PDF document.  When I tried to add a background layer using another product (PDFedit995) after generating the PDF, I could tell that the layer was there, but it was completely obscured by the LPub3D content and its white background.

As for the white band when using the default of A4, I think it may have to do with an incorrect setting within LPub3D.  The correct size in inches is 8.2677 x 11.6929.  If LPub3D is actually rounding this size to 8.3 x 11.7, then my guess is that the page is being shrunk to fit the actual A4 format.  Since the short edge is "more bigger" than A4 than the long edge is, the resulting shrunk page is shorter than 11.6929, resulting in white space. 

LPub3D can display the page size to 4 digits of precision.  I'm hoping that the default sizes are stored the same way.  In which case, all it may take is a correction of the default size(s).

Kevin


RE: LPub3D - Request - Trevor Sandy - 2016-11-24

(2016-11-24, 14:49)Kevin Wrote: I tried setting the background to "transparent" but it appears that LPub3D generates a white background for the PDF document. 

You are right. I use white (with alpha = 1) to get a 'fake' transparent. I do this because If I actually set the background to transparent, it is interpreted by Qt as no background. No background is not good because all components (assy, pli, step number, context menus etc...) are placed via the background so if no background, the generated page will be completely blank. Placing things via the background is an LPub pattern. A rewrite would be overwhelming.

(2016-11-24, 14:49)Kevin Wrote: As for the white band when using the default of A4, I think it may have to do with an incorrect setting within LPub3D.  The correct size in inches is 8.2677 x 11.6929.  If LPub3D is actually rounding this size to 8.3 x 11.7, then my guess is that the page is being shrunk to fit the actual A4 format.  Since the short edge is "more bigger" than A4 than the long edge is, the resulting shrunk page is shorter than 11.6929, resulting in white space. 

LPub3D can display the page size to 4 digits of precision.  I'm hoping that the default sizes are stored the same way.  In which case, all it may take is a correction of the default size(s).

Ah, you may be right. I use the page size settings from this site which rounds to the 10ths as you indicate. If you know of a better source where I can get all the sizes with 4 decimal places that would be great. I would set all the page sizes accordingly. Here is the static table I currently use:
Code:
// page sizes in centimeters and inches
struct pageSizeTypes {
   QString pageTypeSizeID;
   float   pageWidthCm;    // not used - for dev reference only
   float   pageHeightCm;   // not used - for dev reference only
   float   pageWidthIn;
   float   pageHeightIn;
} pageSizeTypes[] = {
{"A0",        84.1,   118.9,    33.1,     46.8},
{"A1",        59.4,    84.1,    23.4,    33.1},
{"A2",        42.0,    59.4,    16.5,    23.4},
{"A3",        29.7,    42.0,    11.7,    16.5},
{"A4",        21.0,    29.7,     8.3,    11.7},
{"A5",        14.8,    21.0,     5.8,     8.3},
{"A6",        10.5,    14.8,     4.1,     5.8},
{"A7",         7.4,    10.5,     2.9,     4.1},
{"A8",         5.2,     7.4,     2.0,     2.9},
{"A9",         3.7,     5.2,     1.5,     2.0},
{"A10",        2.6,     3.7,     1.0,     1.5},
{"ArchA",     22.9,    30.5,     9.0,    12.0},
{"ArchB",     30.5,    45.7,    12.0,    18.0},
{"ArchC",     45.7,    61.0,    18.0,    24.0},
{"ArchD",     61.0,    91.4,    24.0,    36.0},
{"ArchE",     91.4,   121.9,    36.0,    48.0},
{"ArchE1",    76.2,   106.7,    30.0,    42.0},
{"ArchE2",    66.0,    96.5,    26.0,    38.0},
{"ArchE3",    68.6,    99.1,    27.0,    39.0},
{"AnsiA",     21.6,    27.9,     8.5,    11.0},
{"AnsiB",     43.2,    27.9,    17.0,    11.0},
{"AnsiC",     43.2,    55.9,    17.0,    22.0},
{"AnsiD",     55.9,    86.4,    22.0,    34.0},
{"AnsiE",    86.4 ,   111.8,    34.0,    44.0},
{"B0",       141.4,   100.0,    55.7,    39.4},
{"B1",       100.0,    70.7,    39.4,    27.8},
{"B2",        70.7,    50.0,    27.8,    19.7},
{"B3",        50.0,    35.3,    19.7,    13.9},
{"B4",        35.3,    25.0,    13.9,     9.8},
{"B5",        25.0,    17.6,     9.8,     6.9},
{"B6",        17.6,    12.5,     6.9,     4.9},
{"B7",        12.5,     8.8,     4.9,     3.5},
{"B8",         8.8,     6.2,     3.5,     2.4},
{"B9",         6.2,     4.4,     2.4,     1.7},
{"B10",        4.4,     3.1,     1.7,     1.2},
{"Comm10E",  10.47,   24.13,   4.125,     9.5},
{"DLE",       11.0,    22.0,     3.9,      8.2},
{"Executive",19.05,    25.4,    7.25,    10.5},
{"Folio",     21.0,    33.0,     8.5,    13.0},
{"Ledger",    43.2,    27.9,    17.0,    11.0},
{"Legal",    21.59,   35.56,     8.5,    14.0},
{"Letter",    21.6,    27.9,     8.5,    11.0},
{"Tabloid",   27.9,    43.2,    11.0,    17.0},
{"Custom",     0.0,     0.0,     0.0,     0.0}
};



RE: LPub3D - Request - Kevin - 2016-11-24

Code:
// page sizes in centimeters and inches
struct pageSizeTypes {
   QString pageTypeSizeID;
   float   pageWidthCm;    // not used - for dev reference only
   float   pageHeightCm;   // not used - for dev reference only
   float   pageWidthIn;
   float   pageHeightIn;
} pageSizeTypes[] = {
{"A0",         84.1000, 118.9000,  33.1102,  46.8110},
{"A1",         59.4000,  84.1000,  23.3858,  33.1102},
{"A2",         42.0000,  59.4000,  16.5354,  23.3858},
{"A3",         29.7000,  42.0000,  11.6929,  16.5354},
{"A4",         21.0000,  29.7000,   8.2677,  11.6929},
{"A5",         14.8000,  21.0000,   5.8268,   8.2677},
{"A6",         10.5000,  14.8000,   4.1339,   5.8268},
{"A7",          7.4000,  10.5000,   2.9134,   4.1339},
{"A8",          5.2000,   7.4000,   2.0472,   2.9134},
{"A9",          3.7000,   5.2000,   1.4567,   2.0472},
{"A10",         2.6000,   3.7000,   1.0236,   1.4567},
{"ArchA",      22.8600,  30.4800,   9.0000,  12.0000},
{"ArchB",      30.4800,  45.7200,  12.0000,  18.0000},
{"ArchC",      45.7200,  60.9600,  18.0000,  24.0000},
{"ArchD",      60.9600,  91.4400,  24.0000,  36.0000},
{"ArchE",      91.4400, 121.9200,  36.0000,  48.0000},
{"ArchE1",     76.2000, 106.6800,  30.0000,  42.0000},
{"ArchE2",     66.0400,  96.5200,  26.0000,  38.0000},
{"ArchE3",     68.5800,  99.0600,  27.0000,  39.0000},
{"AnsiA",      21.5900,  27.9400,   8.5000,  11.0000},
{"AnsiB",      27.9400,  43.1800,  11.0000,  17.0000},
{"AnsiC",      43.1800,  55.8800,  17.0000,  22.0000},
{"AnsiD",      55.8800,  86.3600,  22.0000,  34.0000},
{"AnsiE",      86.3600, 111.7600,  34.0000,  44.0000},
{"B0",        100.0000, 141.4000,  39.3701,  55.6693},
{"B1",         70.7000, 100.0000,  27.8346,  39.3701},
{"B2",         50.0000,  70.7000,  19.6850,  27.8346},
{"B3",         35.3000,  50.0000,  13.8976,  19.6850},
{"B4",         25.0000,  35.3000,   9.8425,  13.8976},
{"B5",         17.6000,  25.0000,   6.9291,   9.8425},
{"B6",         12.5000,  17.6000,   4.9213,   6.9291},
{"B7",          8.8000,  12.5000,   3.4646,   4.9213},
{"B8",          6.2000,   8.8000,   2.4409,   3.4646},
{"B9",          4.4000,   6.2000,   1.7323,   2.4409},
{"B10",         3.1000,   4.4000,   1.2205,   1.7323},
{"Comm10E",    10.5000,  24.1000,   4.1339,   9.4882},
{"DLE",        11.0000,  22.0000,   4.3307,   8.6614},
{"Executive",  18.4150,  26.6700,   7.2500,  10.5000},
{"Folio",      21.0000,  33.0000,   8.2677,  12.9921},
{"Ledger",     43.1800,  27.9400,  17.0000,  11.0000},
{"Legal",      21.5900,  35.5600,   8.5000,  14.0000},
{"Letter",     21.5900,  27.9400,   8.5000,  11.0000},
{"Tabloid",    27.9400,  43.1800,  11.0000,  17.0000},
{"Custom",      0.0000,   0.0000,   0.0000,   0.0000}
};



RE: LPub3D - Request - Trevor Sandy - 2016-11-24

Many thanks Kevin !! - I updated the parms and indeed, the line no longer appear on A4, Letter or the other page sizes I tested.

I've been chasing this issue for some time. Thanks to you, I think it's now addressed.

Cheers,


RE: LPub3D - Request - Kevin - 2016-11-25

Happy to help.  I edited the previous response to remove the extra commas.

Kevin


RE: LPub3D - Request - Trevor Sandy - 2016-11-25

Kevin - I took another look at the transparent background behaviour. With true transparent (brushColor = Qt::transparent), I am able to get the page to present most of the page components. However, I can not get the page background context menu to present so I've devised some work around logic.

Basically, if the page background is set to none(transparent) by the user, i'll set the page white with alpha=1 during page editing and switch to true transparent for exporting/printing. This way, the user will have the ability to manipulate the page components while editing the document.

This work around is not difficult so look for it in the next release.

Update: Implemented and tested.

Cheers,


RE: LPub3D - Request - Kevin - 2016-11-25

(2016-11-25, 3:34)Trevor Sandy Wrote: Kevin - I took another look at the transparent background behaviour. With true transparent (brushColor = Qt::transparent), I am able to get the page to present most of the page components. However, I can not get the page background context menu to present so I've devised some work around logic.

Basically, if the page background is set to none(transparent) by the user, i'll set the page white with alpha=1 during page editing and switch to true transparent for exporting/printing. This way, the user will have the ability to manipulate the page components while editing the document.

This work around is not difficult so look for it in the next release.

Update: Implemented and tested.

Cheers,

Awesome!  you rock!

Thanks once again.

Kevin