huysentruitw / print-it Goto Github PK
View Code? Open in Web Editor NEWWindows service for printing PDF files to a local or network printer in the background
License: MIT License
Windows service for printing PDF files to a local or network printer in the background
License: MIT License
It should be made possible to pass an optional page range to the print command, so we can specify which pages from the PDF needs to be printed.
Suggestion 1: Add FromPage and ToPage parameters
The API model for the print/from-pdf endpoint (https://github.com/huysentruitw/print-it#post-apiprintfrom-pdf) could be extended with 2 optional values:
When ToPage is not specified, but FromPage is, start from FromPage (inclusive) and print to the end.
When FromPage is not specified, but ToPage is, start from the beginning of the document and print until ToPage (inclusive).
When ToPage < FromPage, throw an error.
This suggestion is rather limited to a single range and doesn't allow complex ranges like you could pass to other print dialogs.
Suggestion 2: Add Pages parameter
The API model for the print/from-pdf endpoint (https://github.com/huysentruitw/print-it#post-apiprintfrom-pdf) could be extended with an optional Pages parameter.
The Pages parameter takes a comma-separated string that supports single pages as well as page ranges, examples:
2
-> Only prints the 2nd page.2-4
-> Prints the 2nd page, until the 4th page.1,3-5
-> Prints the 1st page followed by the 3rd until the 5th page.Great software, thanks for sharing!
However, it would be great to have the possibility to add a number of copies to the printjob.
Add endpoint example for actual printing a PDF document
Thanx for sharing, Great PrintService
I Forked your project to https://github.com/vedat-inal/print-it, and added a extra parameter to select a papertray.
Any plans to make this into a command line tool too? My C# skills are unfortunately not the best otherwise I'd be happy to contribute with a PR
Trying to get this setup, and I can't seem to get the server to respond. At first I thought it was an issue with the service registration or something, so deleted and registered it using NSSM. That also didn't work. Pulled the source and fired up the project and it says it's listening on the correct host:port combo, but no luck. I've tried a variety of ports, checked everything simple I can think of. Anyone else running into this?
Hello, there!
As part of the university research we are currently doing regarding the security of Github Actions, we noticed that one or many of the workflows that are part of this repository are referencing vulnerable versions of the third-party actions. As part of a disclosure process, we decided to open issues to notify GitHub Community.
Please note that there are could be some false positives in our methodology, thus not all of the open issues could be valid. If that is the case, please let us know, so that we can improve on our approach. You can contact me directly using an email: ikoishy [at] ncsu.edu
Thanks in advance
The vulnerability fix that is missing by actions' versions could be related to:
(1) CVE fix
(2) upgrade of vulnerable dependency
(3) fix to secret leak and others.
Please consider updating the reference to the action.
If you end up updating the reference, please let us know. We need the stats for the paper :-)
Currently, the target framework of PrintIt.Core is netcoreapp3.1
.
I tried to switch it to netstandard2.1
, and the build also succeeded.
Do we have any reason to use netcoreapp3.1
?
when running it as service on windows 10. it doesn't print anything. but when debugging it in visual studio it works well
I tried to call 'http://localhost:7000/print/from-pdf' with javascript/ajax from my localhost:80
but I obtain this :
Access to XMLHttpRequest at 'http://localhost:7000/print/from-pdf' from origin 'http://localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
can ( and how ) I fix this ?
thanks
kind regards
Need to change papersize (A5, or custom size)
Any language like PHP will do. I always fail when I debug /api/print/from-pdf. Thank you!
Hi @huysentruitw
I tried to use Postman to call the service to print the file pdf but it keeps sending forever. could you help me?
Step 1: run the service
Step 2: Call the service to print
I have installed two printers on the host where Print-It is installed. One printer has tray 1 set to the default, the other has tray 2 set to the default. If I print a test page they print from the correct trays.
However when I use print-it they always print from tray 1.
If it would use the default that would be great, if not it would be great to be able to pass a tray selection as an optional parameter when printing the PDF.
The api doenst give a setting on scaling/zooming when printing. It seems it uses the default option which it could "adapt" the printing content to the page. And sometime is not intended result.
while running as console application it works fine but while running as windows service it is not working .... the PrintDocument.Print() method not working under windows service ,,, ran the windows service as LocalSystem .....
Here is my config
Windows 8.1
Great software!
Do you plan to add arguments (spool name)?
All spools from this software are "document".
I would like to set the filename as the spool name.
thank you.
I think I did have the service registered and running correctly before, but I was trying to use postman and a web browser to check that I'd set things up correctly. Now I can see the port is listening with Netstat, but still get 404's when trying to add printers or list them using postman.
I've tried several things... Everything returns a 404
GET
http://127.0.0.1:7001/api/printers/list
http://localhost:7001/api/printers/list
POST
http://127.0.0.1:7001/api/printers/install?printerPath=\\printserver\DDG1
Any ideas on what could be going on here? A coworker is having the same issues...
Thank you for sharing.
The solution works fine.
I have a pdf file with a digital signature, after printing it does not show this digital signature, do you have a solution?
Great project! The only one i on the web that makes it super easy to print pdfs on windows.
Question: Could we use the PdfiumCore auto generated bindings instead of using pinvoked functions inside the print-it project?
I believe it would provide easier updates to the library.
Im working on a fork that would use them, but im not sure why it was not used originally - maybe you could help a little
The library has no FPDF_RenderPage
anymore, but FPDF_RenderPageBitmap
Im struggling to convert it because print-it uses System.Drawing.Graphics
and the pdfium prints the pdf to PdfiumCore.fpdfview.FpdfBitmapT
. I dont know easy way around it.
From what i understand if something about Device-Dependent Bitmaps (DDBs) vs Independant ones = bitmap vs HDC (?)
I dont expect full answer, but just a hint if you know how to approach it
I am new to programming but I want to implement it on a javascript to print a pdf file from my desktop,
Thank you!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.