1. Ben Antwi
  2. Valentina Reports ADK
  3. Tuesday, October 18 2022, 04:31 PM
  4.  Subscribe via email
How to display an image from database with filename example 12345.png stored as text in sqlite3 database and the actual image is stored in the working directory named "img/" as filepath. I need assistance. Thank you in advance.
Comment
There are no comments made yet.
Sergey Pashkov Accepted Answer
Hello Ben,

There is no watermark option, an image can be added below all other controls.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 1
Ben Antwi Accepted Answer
Please how do I add a watermark using a logo or image on the report?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 2
Ben Antwi Accepted Answer
I referenced the file with example below and it worked. Thank you very much.

project = valentina.project.connect('file://tempofficials.vsp')


Expression control also worked as expected thank you very much!!!
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 3
Sergey Pashkov Accepted Answer
I want the firstname and last name fields to be together without a vast space between them. Example "Ken Wood" looks good. But some names have so much space between them. Example "Ken Wood". Please how can I control the space between the two name fields with a reasonable or standard space between them. Thanks in advance.


Just add an Expression control instead of separate fields.

Different types of Languages can be used in expressions, I think Text With Macros is the shortest:
$F(first_name) $F(last_name)

JavaScript alternative:
$F('first_name') + ' ' + $F('last_name')

Or SQL (for SQLite):
first_name || ' ' || last_name
Attachments (1)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 4
Sergey Pashkov Accepted Answer
Please when creating. exe for the user how will the filepath be like? Because I used my working directory and it worked. After creating a .exe it doesn't work. Please since I don't know where the user will install the. exe, how should the filepath referenced?


What is the structure of EXE deployment? Does it contain a python source script?
What is returned if you call it for EXE?


import os
print(os.path.dirname(os.path.realpath(__file__)))
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 5
Ben Antwi Accepted Answer
I want the firstname and last name fields to be together without a vast space between them. Example "Ken Wood" looks good. But some names have so much space between them. Example "Ken Wood". Please how can I control the space between the two name fields with a reasonable or standard space between them. Thanks in advance.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 6
Ben Antwi Accepted Answer
Please when creating. exe for the user how will the filepath be like? Because I used my working directory and it worked. After creating a .exe it doesn't work. Please since I don't know where the user will install the. exe, how should the filepath referenced?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 7
Sergey Pashkov Accepted Answer
QPrintPreviewDialog/QPrintDialog is for printing with QPrinter, not using printToLocalPrinter.
Yes, it is possible to print to PDF and then print PDF using QPrinter and QPrintPreviewDialog.
And it should be quite easy.

Another option is to build a custom dialog (I already attached a picture of how it looks).
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 8
Ben Antwi Accepted Answer
I'm using pyqt5 but I have tried tones of examples to implement the dialog and it was not successful.Please could you assist with any reference for this? Below is what I tried.


def printpreviewDialog(self):
printer = QPrinter(QPrinter.HighResolution)
previewDialog = QPrintPreviewDialog(printer, self)
previewDialog.paintRequested.connect(self.printReport)
previewDialog.exec_()


printReport is the method that prints the report
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 9
Sergey Pashkov Accepted Answer
Example of creating a dialog with PyQt? We don't use PyQt, but there are a lot of video lessons on YouTube, so it should be easy to implement one (attached a screenshot of a custom dialog).
Attachments (1)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 10
Ben Antwi Accepted Answer
:( Could you please make an example available here please?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 11
Sergey Pashkov Accepted Answer
Yes, that's how it is done in the Valentina Studio (it is written with C++ Qt).

1. Show a dialog - either system or custom dialog.
For custom dialog, you need to obtain the list of installed printers (report.localPrinters()).
2. Get the printer name and options from the dialog and pass them to printToLocalPrinter
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 12
Ben Antwi Accepted Answer
Please what about say I use a method to display a GUI that can have all the printer options example paper Orientation, copies to print either printing on one side or both sides of the paper. All I need to do is call the method that will start the printing process to print with my GUI method.Is this possible please? If possible could you kindly give me an example of the implementation steps?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 13
Sergey Pashkov Accepted Answer
Now there is only a method to start printing to a specified printer, no GUI is provided.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 14
Ben Antwi Accepted Answer
Please I did not connect to any printer so maybe that might be the cause of that.But i wanted to see the print preview window that will show me all printers and options.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 15
Sergey Pashkov Accepted Answer
No need to call it 3 times, it just shows different options.
So the default printer wasn’t found.
Then I would try to get a valid printer name from report.localPrinters() method and pass it to printToLocalPrinters
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 16
Ben Antwi Accepted Answer
After changing the local printer method from PrintToLocalPrinter to the code below I get no error message and also I don't see all the printers listed.


# Print result as PDF
#report.printToDisk(filename)
report.printToLocalPrinter("", "paper=A4,fit-to-page=yes");
report.printToLocalPrinter("", "paper=A4,landscape=yes,fit-to-page=yes,copies=2");
report.printToLocalPrinter("", "paper=A3,page-set=odd");

# Cleanup
report.close()
project.close()
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 17
Sergey Pashkov Accepted Answer
The documentation is common for different languages.
In Python, method names start with a lower case character, so it is:
printToLocalPrinter

The names of printers can be retrieved using localPrinters method, it returns a list of strings
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 18
Ben Antwi Accepted Answer
I'm still getting some error messages. Below are both code and error message
Attachments (2)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 19
Sergey Pashkov Accepted Answer
You copied a declaration, the examples are below, e.g.:

report.printToLocalPrinter( "LBP3000", "paper=A4" )
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 20
  • Page :
  • 1
  • 2
  • 3


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 2 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories