Andy Pastuszak
Member
Praying for my family and everyone in Ukraine.
Posts: 1,576
What I collect: United States, Ukraine, Ireland
|
Post by Andy Pastuszak on Jul 4, 2024 17:02:33 GMT
Got it Andy Pastuszak , You should have an email from me with a link to a quick and dirty first attempt. If you don't receive it, let me know. Got it. Let me test. Oh wow. This works great! I assume that picture boxes are item type "2." Doing this for catalog numbers is going to be a challenge, since they're just text boxes. But i have an idea. I'll need to tinker when I get back from my sister-in-laws for the annual BBQ. My python is a bit rusty, since almost everything I do is in bash these days. Time to dust off my skills and learn a little python3.
Thank you for making this. You probably got it done in way less time than it would have taken me.
|
|
|
Post by PostmasterGS on Jul 4, 2024 18:16:53 GMT
I couldn't find a good list of what all the item types were, but I know "2" is images and "4" is textboxes. If you want the challenge of figuring out catalog numbers, don't open the second e-mail I sent you. ![;)](//storage.proboards.com/forum/images/smiley/wink.png)
|
|
Andy Pastuszak
Member
Praying for my family and everyone in Ukraine.
Posts: 1,576
What I collect: United States, Ukraine, Ireland
|
Post by Andy Pastuszak on Jul 5, 2024 1:29:45 GMT
I couldn't find a good list of what all the item types were, but I know "2" is images and "4" is textboxes. If you want the challenge of figuring out catalog numbers, don't open the second e-mail I sent you. ![;)](//storage.proboards.com/forum/images/smiley/wink.png)
What you did in the second email is exactly what I was going to try to do.
I'll be testing this shortly.
Thank you for doing this! I really appreciate it.
One nice feature of Scribus is that it's scriptable. If the app doesn't do it, then you may be able to write a script to do it yourself.
|
|
Andy Pastuszak
Member
Praying for my family and everyone in Ukraine.
Posts: 1,576
What I collect: United States, Ukraine, Ireland
|
Post by Andy Pastuszak on Jul 5, 2024 1:47:55 GMT
Ok, I made a test file for Ukraine 2021. It has images in one layer and the catalog numbers in another layer, using the script PostmasterGS emailed me. The only 2 apps I found that will let you work with layers are Adobe Reader and FoxIT PDF reader. If you turn off the layer with images or catalog numbers they will not print. You can find my test PDF here: 1drv.ms/f/s!AtiQqOMmDyztgd8O0OkceKo_NT0Fdg?e=eKPVcp Something interesting I learned from talking to people on the Scribus forums. PDF layers have one of three options: always print, never print or print when visible. But when I generated PDFs in Scribus, I could only set the layers to either always print or never print. When I asked the developers about this, they told me the PDF spec only has 2 options for layers, and that's always print and never print. But Adobe added the print when visible option to their apps and others obviously chose to adopt it. Other PDF viewers don't give you the option to turn layers on and off, because they support the official PDF spec and will not print layers marked as never print. The developers agreed to change the always on option to do "Print When Visible" instead. But, in theory, you could create a PDF with the images as a "never print" layer, and you'd always see them on the screen, but they would never print out.
EDIT: It seems that OneDrive link will not work for some reason if you click on it. You need to highlight it, copy it and paste it into a new browser window/tab for it to work.
|
|
|
Post by PostmasterGS on Jul 5, 2024 2:01:40 GMT
Andy Pastuszak , Did a quick test on Acrobat, and as expected, it works. Not sure if this is expected behavior, but on pp. 8-9, the Europa images are on the StampImages layer. If you haven't modified it already, it would be pretty easy to change the StampImage code to look not for items of type "2", but for items of type "2" whose names start with "shpP". That would avoid accidentally moving non-stamp images in that block of code, assuming the pages were generated with SAPG. Also, if you had to move the catalog numbers that weren't 4-digit numbers – specifically the Blocks – by hand (probably not, if generated by the SAPG), you could also add an OR to look not only for 4-digit numbers, but for text that begins with "Block". Would look like this: In StampImages function strItemType = str(item[1]) strItemName = str(item[0]) if strItemType == "2" and strItemName.startswith("shpP"): scribus.sendToLayer(strStampImageLayerName, item[0])
And in CatalogNumber function strItemType = str(item[1]) strItemName = str(item[0]) if strItemType == "4" and strItemName.startswith("shpK"): scribus.sendToLayer(strCatalogNumberLayerName, item[0]) elif strItemType == "4": strItemText = scribus.getFrameText(strItemName) import re # Regex is set to match 4-digit number only pattern = re.compile("^[0-9]{4}$") if pattern.match(strItemText): scribus.sendToLayer(strCatalogNumberLayerName, item[0]) if strItemText.startswith("Block"): scribus.sendToLayer(strCatalogNumberLayerName, item[0])
Haven't tested this, but it should work.
|
|
Andy Pastuszak
Member
Praying for my family and everyone in Ukraine.
Posts: 1,576
What I collect: United States, Ukraine, Ireland
|
Post by Andy Pastuszak on Jul 5, 2024 2:09:28 GMT
I think the sample PDF I posted also took the BLOCK catalog numbers out.
If this script does 95% of the work and I need to clean up a few catalog numbers by hand, that's not that big a deal. I can handle that.
|
|
|
Post by PostmasterGS on Jul 5, 2024 2:15:34 GMT
Andy Pastuszak, I edited my post above to include the new code. If you generated the pages with SAPG, the CatalogNumber code shouldn't require the tweak, since it's only to account for textboxes that don't follow the SAPG naming convention. The StampImages tweak will stop the stray non-stamp images from being moved, though, again assuming they follow the SAPG naming convention.
|
|
Andy Pastuszak
Member
Praying for my family and everyone in Ukraine.
Posts: 1,576
What I collect: United States, Ukraine, Ireland
|
Post by Andy Pastuszak on Jul 5, 2024 3:02:08 GMT
I'll experiment after work tomorrow. 11:00 PM here and I have work in the morning.
|
|