Serialize printed pages when sent to the printer - printing

I am trying to figure out a way that when I print something, that is identical, it allows me to serialize each page that I print. THe good news is the app that I am using (a custom app) asks me on a previous page how many I need to print and then renders them into a pdf, so i need to insert code to serialize each render of the non-unique page. Any suggestions?

Related

How do you print different templates in netsuite?

I am trying to find the correct template and id to use for a hotprint of an advanced pdf template of an Item Fulfillment.
The hot print url is (with the id bolded) https://system.na3.netsuite.com/app/accounting/print/hotprint.nl?regular=T&sethotprinter=T&id=7600&label=Packing%20Slip&printtype=packingslip&trantype=itemship&orgtrantype=TrnfrOrd&auxtrans=7605
For some reason only certain id=# seems to affect the outcome and the ids I have got to work for two different templates don't match the Custom Transaction Forms ID or the Advanced pdf script id. (example most ids=template 1, while 168,4954, and seemingly random other ids=template 2) I am very confused on how netsuite resolves the hot print url as it normally doesn't include the template= part though I have seen others use it for invoice print urls.
The parameters at the end of the url (the stuff after the ?) are used by Netsuite to control settings used by the webpage which prints the PDFs for you.
In this case, &id=##### refers to the internal id of the document you are printing. You can see this by going to the document, right clicking, selecting inspect, and typing nlapiGetRecordId() into the console. When you click Print, you should see that same number after &id=#####.
&template=### refers to the template you are printing. If you go to Customization -> Forms -> Advanced PDF/HTML Templates, you'll notice a Script ID field in the table. If you substitute the correct Script ID in for the number in &template=###, you'll notice you generate the same PDF. This Script ID acts the same as the number that was previously there.
The reason you're seeing unusual results when you change those numbers is because you're mismatching a record with a template not built for it. So it won't print exactly right, but will sometimes execute anyways.
Anyways, this sort of parameter scheme is a similar scheme to how Suitelets and Restlets work, so in the future, you might experience this sort of thing again.
EDIT: For those reading this in the future, please read the comments.
To customize a packing slip and return form:
If you are printing packing slips and need some customization, you can use a custom invoice form when printing packing slips. For example, you can customize an invoice form to hide the fulfilled item tax rate and amount, and the order total. Then, when you print the packing slip using the custom form through mass print, choose the the packing slip shows the customized information.

Hide/truncate long attributes in rails console

For a blog model I'm saving an RSS field as text under Blog.rss, problem is, some of this is rather long and each one prints when I'm working in the rails console, ie: Blog.last(10).
Is there a way to hide output unless I call someblog.rss specifically?
I had a similar problem and received some solutions in another forum, which were:
Use select to get just the columns you need
If you have a very long column (I had JSON data structure from a webhook cluttering the console), consider whether you really need it, and if you don't , don't store it in the table
Or, consider storing it in an associated table
if you need the whole object but just want to change how it's represented in console/log output, you can redefine inspect
yourobject.as_json(except: :unwanted_column)
Also
You could look into: https://github.com/awesome-print/awesome_print

Generate qr-code which is URL of user-selected-Model's Controller#Show in Rails

Looking for general guidance on design/architecture of this in rails.
Use-case / Goal:
User can go to website, and search for a list of Mortgages (the model in the database):
User will select a single mortgage
After selecting, they will receive a QR Code on the screen which is the URL for the MortgageController#show method for the particular Mortgage that was chosen.
To emphasize: When they select the mortgage, they won't go to the MortgageController#show, rather they need to be returned a page containing a QR code which represents the URL to the proper MortgageController#show for the mortgage they selected.
Context: The QR-code page will be printed, scanned --along with the physical mortgage files-- into a document imaging system. The document imaging system will parse the QR Code, hitting the MortgageController#show, receiving JSON "describing"/representing that particular scanned Mortgage. (Using Qr-code leading to JSON, rather than the raw JSON, as scanners do better with QR-codes than text.).
I think I pretty well understand the MortgageController#show side of things -- it's just returning a JSON representation of the model Mortgage.
Things get fuzzy:
I imagine where the user will search/select a mortgage could be the MortgageController#index method.
But if I have a get QR Code link for each Mortgage, should it hit a custom method on the MortgageController like qr_code, which determines the proper URL which needs to be made into a QR code and returned?
I'm not sure how to organize the part that generates a QR Code pointing to the show method of MortgageController, and how the plumbing of this will work. Is it possible to know from a list of Models, which one was selected from a link, or form_for tag, if that link doesn't go to the standard show method of the controller? (Because I cannot use that method... that's the one that will be returning JSON!)
I'm pretty mixed up about this, and am new to Rails. Any ideas are appreciated!
I'll try to answer all of your questions:
Yes, the action listing the mortgages should be MortgageController#index
For the QR view, you have several choices. One way, probably the most REST-pure, you'll call MortgageController#show on that particular mortgage, using format: :qr, a MimeType you'd define for the occasion (the URL would be /mortgages/2.qr and the path in the form_for block would be mortgage_path(mortgage, format: :qr). In the controller side, you'd handle this using the respond_to |format| structure.
Another simpler option would be to define a non-REST action to present the QR: MortgageController#qr_code. That action you'd define like this on your routes.rb file:
resources :mortgages do
get :qr_code, on: :member
end
As a bonus track (not included in your question), you can use rqrcode_png gem to generate and print the QR codes in the /mortgage/3/qr_code view.

Print the table of contents which is constructed using displayTag?

I am Using Struts2 and Display Tag in my Application. And I am Using navigation with partial="true" option in display table.
I have an another requirement that there is print option. If the User clicks on Print icon, the whole content should send all the records irrespective of navigation.i mean all records. Is it possible to achieve this? If only records in the page means.No problem i can do this. How can i send all the records for the print?

how to get html tags of page without URL

I want to save the HTML tags of whole page that is going to (render) client side in the database table with a unique id so next time I can fetch that page directly from database with id and without any complicate logic execution. All this without any URL means I don't want to pass a URL to any method that will get the HTML tag. I want to get HTML tags before even rendering the page because I have some status system once status changed that URL will not work.
Sorry if my question is not clear, but I tried to mention all details. I simply want HTML tag of my view before sending it to client so that I can save those tags with a unique id in database table and next time I can just fetch those tags from the database table with that unique id. My need is that the view contains many complex queries that I don't want to run each time.
It's a kind of certificate in that once it is printed, it cannot be changed, it can only be viewed by that unique ID in a faster way.
What you want to do is called output caching, use that instead.
If you need to save the HTML output, you need to add an action filter and intercept the Result and save the text in database.

Resources