MacResource
Save a PDF as a serializing number - Printable Version

+- MacResource (https://forums.macresource.com)
+-- Forum: My Category (https://forums.macresource.com/forumdisplay.php?fid=1)
+--- Forum: Tips and Deals (https://forums.macresource.com/forumdisplay.php?fid=3)
+--- Thread: Save a PDF as a serializing number (/showthread.php?tid=68813)

Pages: 1 2


Save a PDF as a serializing number - blusubaru - 12-22-2008

I can't figure out how to word this for a Google search, so thought I'd ask the Automator gurus here. One of my tasks at work is to place anywhere from 10-50 orders for a particular part at the end of each day. Instead of wasting that much paper and ink, I save the confirmations as PDFs and place them on a server for all to view. Now, each of these PDFs have a particular 5-digit part number that is unique to our system. I could copy and paste, I could retype, but since the number is there on every page already, is there any way to get Automator or something similar to pull that number and save the file under that? Since Leopard is very good about indexing PDFs, it doesn't really matter for me as I can find each one rather quickly through Spotlight. However, I'm the only Mac user. Everyone else just sees the serialized numbers (1...2...3) under the folder date (122108). Any ideas?


Re: Save a PDF as a serializing number - space-time - 12-22-2008

I don't know how to do it, but what you could do is to save each PDF as a date-time file, for example 2008-12-21-19-26-30.pdf, that would be today's date at 7:26 PM (and 30 seconds). If there is at least 1 second between those orders, the files should not overlap. This can be done in Automator, you could even replace the "Save PDF to Web Receipts" plug in to do exactly this.

would that work?


Re: Save a PDF as a serializing number - blusubaru - 12-22-2008

That unfortunately doesn't help the PC users wanting to pull the .PDF based on the five-digit number (our internal house number).


Re: Save a PDF as a serializing number - Marc Anthony - 12-22-2008

What app is creating the PDF files?


Re: Save a PDF as a serializing number - blusubaru - 12-22-2008

Firefox. File>print>save as PDF


Re: Save a PDF as a serializing number - Seacrest - 12-22-2008

Saving PDFs from FireFox in that manner gets the file name from the HTML document's tag. All you need is a Greasmonkey script or a bookmarklet that changes the title on the fly. I'm guessing the part # is part of the url's query string or resides in a javascript-accessible node within the document. It's probably trivial to do. <br /> <br /> <hr size="1" /> <!-- end: printthread_post --><!-- start: printthread_post --> <strong>Re: Save a PDF as a serializing number</strong> - <a href="https://forums.macresource.com/member.php?action=profile&uid=108">blusubaru</a> - <strong>12-22-2008</strong> <br /> <br /> Hmm... coding is not my thing! But yes, the title of the document comes from the header of the page. It's the same for each one, the title of the vendor. I just add a 1, 2, 3... to the end of the title to save multiple PDF's in one folder. If I could get the default to save as the house number instead, that would be stellar. <br /> <br /> It looks like there is an identifiable part of the page source that determines the house number. Here's a snippet: <br /> "input type="hidden" name="part_no" value="888888" <br /> where 888888 is a test house number. It appears in five total places, and is entered up to two different places on the ordering page. <br /> <br /> <hr size="1" /> <!-- end: printthread_post --><!-- start: printthread_post --> <strong>Re: Save a PDF as a serializing number</strong> - <a href="https://forums.macresource.com/member.php?action=profile&uid=39">Seacrest</a> - <strong>12-22-2008</strong> <br /> <br /> <pre class="code"> j‌avascript: (function(){document.title=document.forms[0].part_no.value;window.print()})();<br /> </pre>*<br /> <br /> If there's only one form on the page, this should work.<br /> Create a new bookmark, and set this as the URL.<br /> When you want to print the page, choose that bookmark.<br /> <br /> <br /> If there is more than on form on the page, you're going to have to figure out which form element contains 'part_no.'<br /> <br /> *you'll need to get rid of the space between 'j‌avascript:' and the first '('. <br /> <br /> <hr size="1" /> <!-- end: printthread_post --><!-- start: printthread_post --> <strong>Re: Save a PDF as a serializing number</strong> - <a href="https://forums.macresource.com/member.php?action=profile&uid=108">blusubaru</a> - <strong>12-22-2008</strong> <br /> <br /> OMG! You freaking rock! Thank you so much! <br /> <br /> <hr size="1" /> <!-- end: printthread_post --><!-- start: printthread_post --> <strong>Re: Save a PDF as a serializing number</strong> - <a href="https://forums.macresource.com/member.php?action=profile&uid=877">space-time</a> - <strong>12-22-2008</strong> <br /> <br /> so did you install greasemonkey, or you just put this bookmark? <br /> <br /> <hr size="1" /> <!-- end: printthread_post --></td> </tr> </table> <script><!-- var ct_checkjs_val = 'dd51df252dab43b61849446539dc9759', d = new Date(), ctTimeMs = new Date().getTime(), ctMouseEventTimerFlag = true, //Reading interval flag ctMouseData = "[", ctMouseDataCounter = 0; function ctSetCookie(c_name, value) { document.cookie = c_name + "=" + escape(value) + "; path=/;"; } ctSetCookie("ct_checkjs", ct_checkjs_val); ctSetCookie("ct_ps_timestamp", Math.floor(new Date().getTime()/1000)); ctSetCookie("ct_fkp_timestamp", "0"); ctSetCookie("ct_pointer_data", "0"); ctSetCookie("ct_timezone", "0"); setTimeout(function(){ ctSetCookie("ct_timezone", d.getTimezoneOffset()/60*(-1)); },1000); //Reading interval var ctMouseReadInterval = setInterval(function(){ ctMouseEventTimerFlag = true; }, 150); //Writting interval var ctMouseWriteDataInterval = setInterval(function(){ var ctMouseDataToSend = ctMouseData.slice(0,-1).concat("]"); ctSetCookie("ct_pointer_data", ctMouseDataToSend); }, 1200); //Stop observing function function ctMouseStopData(){ if(typeof window.addEventListener == "function") window.removeEventListener("mousemove", ctFunctionMouseMove); else window.detachEvent("onmousemove", ctFunctionMouseMove); clearInterval(ctMouseReadInterval); clearInterval(ctMouseWriteDataInterval); } //Logging mouse position each 300 ms var ctFunctionMouseMove = function output(event){ if(ctMouseEventTimerFlag === true){ var mouseDate = new Date(); ctMouseData += "[" + Math.round(event.pageY) + "," + Math.round(event.pageX) + "," + Math.round(mouseDate.getTime() - ctTimeMs) + "],"; ctMouseDataCounter++; ctMouseEventTimerFlag = false; if(ctMouseDataCounter >= 100) ctMouseStopData(); } }; //Stop key listening function function ctKeyStopStopListening(){ if(typeof window.addEventListener == "function"){ window.removeEventListener("mousedown", ctFunctionFirstKey); window.removeEventListener("keydown", ctFunctionFirstKey); }else{ window.detachEvent("mousedown", ctFunctionFirstKey); window.detachEvent("keydown", ctFunctionFirstKey); } } //Writing first key press timestamp var ctFunctionFirstKey = function output(event){ var KeyTimestamp = Math.floor(new Date().getTime()/1000); ctSetCookie("ct_fkp_timestamp", KeyTimestamp); ctKeyStopStopListening(); }; if(typeof window.addEventListener == "function"){ window.addEventListener("mousemove", ctFunctionMouseMove); window.addEventListener("mousedown", ctFunctionFirstKey); window.addEventListener("keydown", ctFunctionFirstKey); }else{ window.attachEvent("onmousemove", ctFunctionMouseMove); window.attachEvent("mousedown", ctFunctionFirstKey); window.attachEvent("keydown", ctFunctionFirstKey); } // --> </script></body> </html> <!-- end: printthread -->