Improve feature: Allow more paper formats for printing tiled PDF

Issue #657 resolved
Roman Telezhynskyi repo owner created an issue

Currently Valentina supports tiled PDF printing only on A4.

Comments (20)

  1. Ronan Le Tiec

    I will work on this issue if that's ok with you. Before that I'd like to discuss with you what my thoughts and ideas are.

    Goal of this issue

    Be able to export tiled pdfs in various paper formats. We should be able to set other format in the GUI, but also from the command line.

    What we have

    For the moment, there is no dialog in the GUI to make any configuration for the tiled pdfs. Some of the values of the layout-dialog are used, like "portrait vs landscape" or the margins.

    The exports functions are triggered in File > Layout > Preview tiled PDF / Print Tiled PDF / Export as (format "pdf tiled files")

    My thoughts / Ideas

    Create a new dialog which is called under File > Layout > create tiled pdf. This entry in the menu would replace "preview tiled pdf" and "print tiled pdf".

    The dialog could look like this:

    dialog_tiled_pdf.jpg

    I would make the paper format settings like it's done in the layout dialog. The functions for preview, printing and save would be started from the dialog via the 3 buttons.

    This dialog could be extended in the future for instance to set different margins than in the layout dialog, to be able to crop the unused width and length, or have a small preview on how the layout will be divided. Maybe we could also make it possible to export tiled pdf from the detail, like you did for SVG. But that's future music :-)

    What do you think?

  2. Roman Telezhynskyi reporter

    Looks good, but still has several problems.

    Did you see my last changes? I moved Save as tiled PDF to Export as dialog. By this dialog i do support a command line. Your new dialog should have only one option - paper format. Don't forget, user will print on regular printer, no need to support custom format. As to Portrait/Landscape i have found that we should always print in Portrait. Landscape will require rotating the whole image on 90 degree to be viewed by printer correctly.

    I recommend you look into Save as dialog. Probably the best option will be to extent it as i did for DXF.

    So, don't rush the ideas is not finished now.

  3. Ronan Le Tiec

    Don't forget, user will print on regular printer, no need to support custom format

    You're totally right. No need for width, height and unit, I was thinking too much customisable.

    As to Portrait/Landscape i have found that we should always print in Portrait.

    Do you think it would be hard to achieve with the 90 degree rotating? I like the idea of being able to choose portrait or landscape, I'll give you an example why:

    I've created a waistand and I wanted to print only this piece. the bounding box is roughly 935mm x 120mm (the waistband is curved). If the tiles are in portrait, i would need 5 pages, but if the tiles were in landscape, then I would only need 4 pages.

    This example is very specific, but i'm sure they are other cases like this. For me it means minimizing the waist of paper, that's why I'd like to have this option. But if you think it's going to be too hard to implement, I understand.

    I recommend you look into Save as dialog. Probably the best option will be to extent it as i did for DXF.

    This way would be probably less work indeed. One drawback would be that we wouldn't be able to have those configurations for the preview and for the direct print. But honestly I wouldn't use the direct print or preview for the tiled pdf, i would probably always save it and then print it from my pdf reader. That beeing said, everyone works differently.

    So, don't rush the ideas is not finished now.

    No worries, I will start only when we have decided on everything and you give me the go :-)

  4. Roman Telezhynskyi reporter

    Do you think it would be hard to achieve with the 90 degree rotating? I like the idea of being able to choose portrait or landscape

    I did research and have found that the printer setting Orientation has nothing to do with actual size of paper sheet. You can repeat my experiment. Right now Valentina print only in portrait orientation. Select landscape orientation when creating a layout. Consequently width > height. Generate it and try to print. In my case a printer automatically recognize right orientation in settings and rotate an image to landscape format.

    This way would be probably less work indeed. One drawback would be that we wouldn't be able to have those configurations for the preview and for the direct print. But honestly I wouldn't use the direct print or preview for the tiled pdf, i would probably always save it and then print it from my pdf reader. That beeing said, everyone works differently.

    Instead of custom fields you can use printer options.

    print.png

    Show combobox and button Properties if user selected save to PDF/tiled PDF and get options from it.

    Also i see that printer option doesn't get all settings we already know, like paper size and margins. Can you try to fix this too?

    So, i propose you to add a label, a combobox with list of all printers and button Properties. One thing to note. By default they also propose PDF printer. Qt will not see it. We can add it to the list manually.

  5. Ronan Le Tiec

    I did a little test, when I set printer.setOrientation(QPrinter::Landscape); in the function MainWindowsNoGUI::PdfTiledFile(const QString &name) , then in the output pdf is actually what we want : the tiled pdf has been generated in landscape format. The drawback is that when i open the file in my external pdf reader, I need to specify in the printing options that the pdf is in landscape, otherwise a part of each page is cut.

    I did another test, like you said with the layout. I created a A4 layout with 2 small pieces and chose landscape. When I print it from valentina, it recognised right and printed properly. When I first save it as a pdf, it's like in my other test, when printing the it from the external pdf reader, i need to specify it's landscape.

    When I did try to "print tiled pdf" directly from valentina, it printed the layout, not the tiled pdf. Is it a known bug?

    I'm not sure if I understood what you meant with the printer options. Let me rephrase it to be sure :

    In the dialog "Save Layout" (opened with file > layout > export as), when I select the file format "PDF tiled files", I should display or unblock the combobox of the available printers as well as the properties button.

    Then if the user want to have the tiled pdf in landscape mode, he needs to click on "properties" of the printer and select lanscape ? I'm wondering if the users will be confused to be able to select a printer in a "save as" dialog and if he'll think about the properties for the landscape mode.

    I think I misunderstood what you meant.

    For the paper size & margins in the "printer properties"-dialog, I could have a look so that they are set like in the layout dialog.

  6. Roman Telezhynskyi reporter

    When I did try to "print tiled pdf" directly from valentina, it printed the layout, not the tiled pdf. Is it a known bug?

    I will look.

    I think I misunderstood what you meant.

    No, you understood me right. But probably you are right, selecting a printer is not the right decision. We need three options: orientation (if you want to rotate an image), margins, and paper format.

  7. Ronan Le Tiec

    ok, so we know that we need those 3 options, the main question is were to be able to edit them.

    The first possibility is to edit them directly in the "save layout dialog", they would be working like "binary form" for the DXF files, as you suggested.

    Another possibility is to edit those parameters in the central "preferences". It would resolve the problem of were to edit them for "tiled pdf preview" and "print tiled pdf". But it makes it maybe more difficult for the command line tiled pdf creation. It also make more clicks for the users if he wants to change the values.

    Which solution is the best in your opinion?

  8. Roman Telezhynskyi reporter

    Which solution is the best in your opinion?

    The first. We need to keep supporting generation tiled PDF from command line. Just disable controls if format is not tiled PDF.

  9. Ronan Le Tiec

    First step : extended the save layout dialog in the GUI :

    saveLayout1.jpg

    Margins and Paper format are enabled only for PDF tiled files.

    The next step is to initialise all the values correctly.

    The initialisation of the paper templates is already implemented in the dialogLayoutSettings. To avoid doing the same thing twice, i was thinking about puting the list of templates in a more central place. Where would be the best place for that?

    When the user changes the margins / the template or the orientation, I would save the values in the central valentinaSettings, so that the values are the same the next time. Is it ok?

  10. Roman Telezhynskyi reporter

    Where would be the best place for that?

    Let's make less dependencies. Create a header file common for two dialogs. And move definition there.

    Is it ok?

    But warn about not correct margins.

  11. Ronan Le Tiec

    Thanks for the code review!

    I've got a question, when exporting the detail, we use the save layout dialog as well. But the "pdf tiled" file format is removed from the list. What's the reason?

    For my use, it would be awesome to be able to export the detail as tiled pdf as well. It can be tricky to have the best use of space with the automatical layout. When I place the pieces manually like in detail, I get more or less what i want.

    Anyway, maybe it's another issue, or not so important for now.

  12. Roman Telezhynskyi reporter

    Thanks for the code review!

    You are welcome.

    I've got a question, when exporting the detail, we use the save layout dialog as well. But the "pdf tiled" file format is removed from the list. What's the reason?

    There is no technical reasons not to allow export as tiled PDF without the layout step. But the detail mode was not created to export details as layout. It lacks of some basic features: paper size, rotation. And the most importantly it cannot guarantee right position after gradation or any recalculation. I believe that right way is to improve the layout generator. It was developed for this particular purpose. The reason for export details by skipping the layout step was in overhead that gives the step. Many users to export in vector formats do not need a layout. They will create new one anyway. And this feature is the easiest way to quickly fix the issue.

    Also we should not forget that one promising way to use Valentina is to call it from command line. And because you can create tiled PDF from command line as well we cannot allow to do it from a command line.

    But as a compromise we can allow to do it from GUI only. What do you think?

    Anyway, maybe it's another issue, or not so important for now.

    If you agree with my proposal please create new issue.

  13. Ronan Le Tiec

    If you agree with my proposal please create new issue.

    Done, it's issue #736

    When the user changes the margins / the template or the orientation, I would save the values in the central valentinaSettings, so that the values are the same the next time. Is it ok?

    Could you answer this question?

    But warn about not correct margins.

    Do you mean warn the same way as when creating the layout ? with the "fields go beyond printing" warning ?

    speaking of "fields go beyond printing", it should probably now be called "margins go beyond printing instead". I will correct it.

    I'm not sure how to handle the unit of the margins here. I will use the default unit defined in the central settings, but i'm not sure how to check if the default unit changed. Can you give me a hint?

  14. Roman Telezhynskyi reporter

    Could you answer this question?

    Yes, it's ok.

    Do you mean warn the same way as when creating the layout ? with the "fields go beyond printing" warning ?

    Yes.

    speaking of "fields go beyond printing", it should probably now be called "margins go beyond printing instead". I will correct it.

    Agree.

    I'm not sure how to handle the unit of the margins here. I will use the default unit defined in the central settings, but i'm not sure how to check if the default unit changed. Can you give me a hint?

    Always save in known units, for example cm and convert for current each time you get value.

  15. Log in to comment