Log of #ghostscript at irc.freenode.net.

Search:
 <<<Back 1 day (to 2020/09/23)Fwd 1 day (to 2020/09/25) >>>20200924 
Antonio81 Hello08:36.32 
ghostbot Welcome to #ghostscript. If you have a question, please ask it, don't ask to ask it. Do be prepared to wait for a reply as devs will check the logs and reply when they come on line. If you are looking for help or infomation about MuPDF, try the new #mupdf channel.08:36.32 
Antonio81 I've got a problem that I'm not being able to solve. I'm currently using ghostscript to auto adjust pdfs for printing (as A4 paper size) but when the text is out of the printing area ghostscript cannot adjust its size automatically08:38.17 
kens Antonio81: I'm afrdaid I don't really understand what you are asking Ghostscript to do08:39.12 
Antonio81 why?08:39.29 
  the thing is08:39.42 
kens Its not clear to me what you mean by 'out of the printing area' and why you expect Ghostscript to do something 'automatically'. You haven't given me a command line, which makes it hard to knwo what you are doing, and ideally an example file to demonstrate the problem woudl be helpful08:40.34 
Antonio81 when you are printing a PDF file using acrobat reader there is an option that will auto fit the pdf to the printing area (sometimes shrinking the pdf area to fit the printing area)08:40.35 
  ok, 1 sec :D08:40.46 
  gswin64 -q -sDEVICE=pdfwrite -sDEFAULTPAPERSIZE=a4 -dCompatibilityLevel=1.4 -dBATCH -dNOPAUSE -o output.pdf -c "<< /BeginPage {0.99 0.99 scale 2 10 translate } >> setpagedevice" -f input.pdf08:41.06 
kens OK so you are generating a new PDF file from the original08:41.30 
Antonio81 i've used this command and it scales the pdf file, but if I rerun the command using the output file it will scale again08:41.50 
kens Umm, well, yes,08:42.05 
Antonio81 and what I'm looking for is something that auto scales the document08:42.12 
kens The command scales the PDF content every time08:42.15 
Antonio81 yes08:42.19 
kens That's what you've told GS to do :-)08:42.35 
Antonio81 If the document already fits the printing area, It would not be needed to scale08:42.47 
kens If I understnad what you want (I could esily be mistaken) then I'd suggest you define the media size as FIXED, and then use -dPDFFitPage08:43.11 
Antonio81 I've thought of extracting the document's pages size08:43.13 
  and then check if the page needed to be scaled or not08:43.33 
kens SO if you want teh content on A tehn :08:44.08 
  -dDEVICEHIGHTPOINTS=792 -dDEVICEWIDTHPOINTS=692 -dFIXEDMEDIA -dPDFFitPage08:44.08 
  A4 that is sorry08:44.14 
Antonio81 its ok :D08:44.19 
kens And -dDEVICEHEIGHTPOINTS=79208:44.30 
  Obviously I can't type this morning :-(08:44.43 
Antonio81 but that raises another problem :D08:44.50 
kens So if the PDF file uses A4 media, then no scaling will take place, if it uses (eg) A3 then it will scale by 50%08:45.04 
Antonio81 If I try to print it on its orginial size the printer will ask me to select the paper size08:45.16 
  i'll give you an example, 1 sec08:45.42 
kens OK08:45.48 
Antonio81 can you please open the image? https://prnt.sc/umyc4e08:47.22 
  and I will explain it to you08:47.38 
kens OK I see that08:47.39 
  Italian ?08:48.08 
  Umm no08:48.17 
Antonio81 Portuguese08:48.22 
  https://prnt.sc/umycux08:48.23 
  and the other one08:48.26 
kens Yep got both08:48.43 
Antonio81 On the first picture, if you check the green rectangles that information will not be printed (maybe because of the margins)08:48.54 
kens I would guess so, yes, looks like hte printer has non-printable margins08:49.26 
Antonio81 but on the second image, everything is printed because adobe acrobat auto adjusts the pdf to the printing area08:49.28 
kens Yes, its sets it to 96% if I read that correctly08:49.56 
Antonio81 so, my question is if there's any option similar to adobe auto adjust for evey pdf08:49.57 
kens No, that's part of the printing system, nothing to do with the PDF.08:50.16 
Antonio81 but if i use this command gswin64 -q -sDEVICE=pdfwrite -sDEFAULTPAPERSIZE=a4 -dCompatibilityLevel=1.4 -dBATCH -dNOPAUSE -o "D:\Antonio\CentralCer\output.pdf" -c "<< /BeginPage {0.99 0.99 scale 2 10 translate } >> setpagedevice" -f "D:\Antonio\CentralCer\input.pdf"08:50.42 
kens The printing system knows what the printable area of the media is, and knwos the size of the PDF08:50.47 
Antonio81 it will print correctly08:50.58 
kens Sure, if you know the printable area, then you can do rthe same adjustment yourself.08:51.16 
Antonio81 and it is working as intended, the problem is that on another pdf I might not need to do that08:51.19 
kens But there's no way for Ghostscript to know that.08:51.24 
Antonio81 and that command will always resize08:51.25 
kens Absolutely, yes, but as I say Ghostscript can't know what you want to do.08:51.53 
  You can indeed find the media size from the PDF file08:52.06 
Antonio81 ok @kens08:52.30 
  thanks a lot for your help :D08:52.36 
kens But that won't immediatley tell you whether the content fits into the printable area.08:52.39 
chrisl If you're willing to do some scripting, it would be possible08:52.42 
Antonio81 i am08:52.47 
  I have to get it to work for my company...08:52.53 
kens Its possible the left and bottom might be white08:53.03 
Antonio81 either using ghostscript or another program08:53.06 
chrisl There is a device (bbox) that will print the bounding box of the page markings08:53.14 
kens was about to reccomend bbox as well :-)08:53.29 
chrisl Comparing that to the imageable area of the printer would tell you whether you need to scale, and by how much08:54.10 
Antonio81 chrisl is it available on gs?08:54.51 
kens yep, the bbox device08:55.01 
chrisl It's a gs device, yes08:55.04 
Antonio81 i will give it a look :D08:55.15 
  thanks a lot guys08:55.19 
chrisl Good luck!08:55.27 
kens NP please come back if you have more questions08:55.32 
Antonio81 i will :D08:55.59 
  can I get the printing area size from the printer?09:24.52 
chrisl From the printer manual?09:27.24 
  You might be able to find PPD file(s) for the printer(s)09:28.29 
  I've no idea if you can retrieve that sort of info from the Windows print system, but I suspect, even if you can, it would need C++/C# coding....09:30.39 
  And whether (and how!) you could do it by communicating directly with the printer would be entirely dependent on the individual printer09:31.44 
kens PPD is probably the better bet, possibly there's a spool API to retrieve it09:35.00 
  I think the printer driver knows the characteristics of the pritner on Windows, but querying it would need C/C++/C# coding I think09:35.54 
  Well apparently its available 'somewhere' Microsoft docs gave me this (eventually):09:54.42 
  https://docs.microsoft.com/en-us/dotnet/api/system.drawing.printing.pagesettings.printablearea?view=dotnet-plat-ext-3.109:54.42 
Antonio81 @ken10:31.39 
  @kens thanks10:31.44 
kens Sorry I can't give you any more clues, Microsoft have changed the printing API totally since I last looked at it10:32.08 
Antonio81 Hi again14:45.17 
velix Can ghostscript handle SVG?19:59.36 
 <<<Back 1 day (to 2020/09/23)Forward 1 day (to 2020/09/25)>>> 
ghostscript.com #mupdf
Search: