Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to add filepath for storing PDF files in specific folder
QtWS25 Last Chance

How to add filepath for storing PDF files in specific folder

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 716 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Piyush
    wrote on last edited by
    #1

    There seems to be no attribute which allows us to store PDf file in different folder. My printer function looks something like this:

    def get_print(self):
        dialog = QtPrintSupport.QPrintDialog()
        self.handlePaintRequest(dialog.printer())
        
    def handlePaintRequest(self, printer):
        printer.setOrientation(QtPrintSupport.QPrinter.Landscape)
        printer.setPaperSize(QtCore.QSizeF(297,420), QtPrintSupport.QPrinter.Millimeter)
        printer.setOutputFormat(QtPrintSupport.QPrinter.PdfFormat)
        temp_pdf =  "abc.pdf"
        
        printer.setOutputFileName(temp_pdf)
        
        (self.pdf).append(temp_pdf)
        
        self.ui.tabWidget.render(QtGui.QPainter(printer))
    
    1 Reply Last reply
    0
    • P Offline
      P Offline
      Piyush
      wrote on last edited by
      #2

      @mrjj Can you please help?

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Did you try to just use the full path to where you want your file to be rather than just give it the name ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        3
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          @Piyush said in How to add filepath for storing PDF files in specific folder:

          printer.setOutputFileName(temp_pdf)

          temp_pdf = "c:/xxx/yyy/abc.pdf"
          Here you would just use full path.
          However, a more normal case is to use
          http://doc.qt.io/qt-5/qfiledialog.html
          so user can select folder.

          1 Reply Last reply
          3

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved