Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[windows] remove "https://tauri.localhost/" from print using rust. #1300

Open
OHELLEL opened this issue Jun 21, 2024 · 10 comments
Open

[windows] remove "https://tauri.localhost/" from print using rust. #1300

OHELLEL opened this issue Jun 21, 2024 · 10 comments

Comments

@OHELLEL
Copy link

OHELLEL commented Jun 21, 2024

Is your feature request related to a problem? Please describe.
How Can I hide url path while print using rust without user interaction (hiding header and footer)

Describe the solution you'd like
I need to be able to control print from my app completely because I need to print html content a lot in my apps, I am using electron, but I am trying to migrate to tauri but this feature is a real pain because users of my app will definitely complain if they see "https://tauri.localhost".

@TheAwesome98-Real
Copy link

can you explain more? this doesn't seem to make sense. if you're talking about the command-line output, the users can't see it at all.

@OHELLEL
Copy link
Author

OHELLEL commented Jun 23, 2024

When you invoke window.print it opens the native print window which inject a script to your html and adds a header (app name) and footer (url), the user can scroll down and look for a checkbox that toggle this in the native print dialog, but its confusing for most users to see "https://tauri.local/" printed on their reports paper for no reason.

@OHELLEL
Copy link
Author

OHELLEL commented Jun 23, 2024

I can't use jsPDF or any other pdf library because they don't support rtl languages fully but the browser have a good rendering engine when it comes to rtl languages.

I am using electron right now and it works perfectly because electron has a feature:

webcontents.printToPDF.

But distributing multiple 70mb-140mb apps (Simple apps) is kinda of annoying.

@amrbashir amrbashir changed the title remove "https://tauri.localhost/" from print using rust. [macOS] remove "https://tauri.localhost/" from print using rust. Jun 24, 2024
@OHELLEL OHELLEL changed the title [macOS] remove "https://tauri.localhost/" from print using rust. [windows] remove "https://tauri.localhost/" from print using rust. Jun 24, 2024
@pewsheen
Copy link
Contributor

Hmm, if you can control the HTML of content, perhaps you can try using CSS: https://stackoverflow.com/questions/8228088/remove-header-and-footer-from-window-print

On Windows, we simply call window.print() to launch the panel, and it doesn't take any option.

@OHELLEL
Copy link
Author

OHELLEL commented Jun 24, 2024

Setting the body margins instead of the page margins will add margin-top for the first page but not the rest (2,3,4,5 ...... Etc will have margin-top:0).

This can't be controlled using css or JavaScript.

So it essential to find away to generate pdfs directly using the webview api without the need for native print preview, this is a truly important feature for desktop apps

@OHELLEL
Copy link
Author

OHELLEL commented Jul 5, 2024

This can be solved by adding printtopdf method that silently generate a pdf from the current window with developer settings.

@OHELLEL
Copy link
Author

OHELLEL commented Jul 15, 2024

Any updates about this feature (pdf silent print)

@pewsheen
Copy link
Contributor

pewsheen commented Jul 22, 2024

#1317 is implementing the option. Let's see what we can do there

@OHELLEL
Copy link
Author

OHELLEL commented Jul 22, 2024

This will be great looking forward for this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants