Printing two A6 booklet sequences from one A4 page - pdf

This question is in regards to this answer that was made a long time ago:
getting two A6 complete booklet sequences from an A4 page
I have been trying to create this imposed pdf for a long time using the script but nothing is happening.
First of all I am a n00b in anything related to scripting but can do it when its necessary.
Here is what I did:
I copied the script in text file and changed the extension to .ch and named it new.ch and changed the following values:
file=$1 multivalentpath=$2
to
file=$abc.pdf multivalentpath=$D:\Multivalent.
I put the multivalent.jar file, pdf file and the script in a single folder.
I wrote:
new abc.pdf multivalent relative path
but nothing happens. Can you please help me out here.
Masud

Related

R Markdown - Output lines too long in pdf

I have the following problem. I have a report that I wrote in RMarkdown. It works great, but when I look at the output in pdf (in HTML is fine), some output lines are way too long and goes outside the page. You can see an example in the image. I simply get some strings from a data.frame, nothing fancy. The strings are long but they don't get wrapped... Anyone had any idea? I found this question Pandoc: Long tablerows in Markdown->PDF documents do not get linewrap. I checked the docs but I could not really understand what to change in my markdown code...

How to create different file names for every new document in Photoshop?

I have an A4 size document with 6 Photos, while I am trying to cut one photo from the original and create a new document the new file name is created as "Untitled-1".
Since I am using an Action to cut from original and paste it into the new document, every new file is opened with same name as "Untitled-1" and while saving it replaces the existing.
Is there any way to make every new document with sequence number or any different names for each file while create new document in Photoshop?
Or else please suggest if any script is available for the same.
Please find below screenshot for your clear understanding.
thanks in advance.
Full page image
Every new document name
Are you familiar with slices? It's beneath the crop tool - You can slice up your document the way you want it, then Export > Save for web, then each slice will save as an individual file.

How to parse text from a plain text file and use the result to highlight a PDF file

Back in 2010, some guy claimed to be capable of doing this:
http://www.mobileread.com/forums/showthread.php?t=103847
"The Kindle stores its annotations in a Mobipocket (".mobi") file for each document and in one long text file named "My Clippings.txt." In this post I describe a system that synchronizes these annotations with PDF versions of the corresponding documents on a computer.
Overview
This system is embodied in an Applescript that parses the My Clippings file and controls the Skim PDF reader. The script first parses the clippings file. It then searches through the clippings and isolates any that come from documents on the kindle matching the filename of the currently open PDF file (the "pertinent clippings"). The script then iterates through each of the pertinent clippings, locating the matching text or location in the PDF document and applying highlights or adding notes where appropriate. The end result is an annotated, printable PDF document that matches the document on the kindle.
You can download the script here: http://dl.dropbox.com/u/2541109/KindleClippings.scpt. Before running the script, be sure to change the value of MyEmail to match your sending address and to verify that the Kindle mount point defined in MyClippingsFile is correct. You'll also need the free Skim PDF Reader.
To use it, send or copy a document file to your kindle. Remember, the kindle supports RTF, DOC, TXT and other common text formats and it will convert them into MobiPocket files internally for easier reading. Make some notes. Then take the same document that you just sent to the kindle and convert it to a PDF, e.g. by using the print to PDF feature in Mac OS X. Be sure to keep the filename the same. Open that same PDF in Skim and run the script. The highlights and notes should appear in the PDF.
If you're interested in how this works, read more on my blog here:
[not longer available]
Sadly, his script is no longer available, nor his blog.
Do you guys know if this is possible? I've been looking for this kind of functionality but can't find it anywhere.
This code, using python and PyMuPDF, works:
import fitz
# the document to annotate
doc = fitz.open("text_to_highlight.pdf")
# the text to be marked
text_list = [
"first piece of text",
"second piece of text",
"third piece of text"
]
for page in doc:
for text in text_list:
rl = page.search_for(text, quads = True)
page.add_highlight_annot(rl)
# save to a new PDF
doc.save("text_annotated.pdf")
The original 'My Clippings.txt' should be manipulated somehow, stringr could work but I found more useful to manipulate the text with multiple selections in Sublime Text---the goal is to have a list of highlights in the form of text_list above.
I am trying to do this using Python + a Windows macro creator (I'm a Win 7 user). You can use this approach to save the file as RTF, DOCX, PDF, etc. So far, it's been reasonably effective. Do note 2 things first:
1- the 'My Clippings' file only saves the text and the page, it does not save the location on the page (e.g., if you highlighted "mammals are animals" on page 15, it will give you this line and the page number, but if there are more than one "mammals are animals" on page 15, it's impossible to know which one you've highlighted). This is specially bad when you've highlighted a generic word, like "animals" or "the". And if you made comments by pressing on a word, this word is the only information you'll get about what in that page the comment refers to (e.g., I pressed on "animals" and the menu popped up, I selected 'Comment'. If "animals" appears 20 times on page 15, I cannot know to which of them my comment is refering).
2- The only way to retrieve the location on the page would be to analyze the *.pds and *.pdt files, inside the *.sdr folder in Kindle's drive ('Documents'). I can make no sense of these files.
In Python, you can run an easy code to extract the information you want from "My Clippings". Then you can use a macro creator to automate the process of copying the text and annotating it to the PDF (using Adobe Acrobat, for example), and then saving the PDF file.
Exemplifying with Adobe Acrobat:
Say I want to save all my highlights to the PDF file. First, I'll create a *.txt file on Python and run a script to copy all the strings related to the highlights to this new txt file (i.e., the highlighted text & the page number). Here's an example of such code (but first, copy and paste the "My Clippings.txt" file to the IDE start folder, e.g.: C:\Python27):
#for python 2.7.6
with open('My Clippings.txt','r') as rf:
with open('My Clippings Output.txt','w') as wf:
access = 0
bookTitle = 'Book Title'#put the book file's name as it's written in "My Clippings.txt"
for x in rf:
if access == 1:
wf.write(x)
if bookTitle in x:
access = 1
#for highlights only, instead of all annotations, include this if statement:
if (' | Added on ' in x) and ('- Your Note ' in x) or ('- Your Bookmark ' in x):
access = 0
if x == '==========\n':
access = 0
Then I'll create a macro to copy the page number in the "My Clippings Output.txt" file (it's inside the same folder you put the "My Clippings.txt" file), paste in Acrobat "page window", find (ctrl+f) the string in the page, then press "highlight". Done!
There's a catch in Acrobat though, the search/find function has a limit of ~28 chars, so your highlighted text can't be longer than that. I still don't know how to circumvent this limitation... I raised this problem here https://superuser.com/questions/884221/how-to-search-and-highlight-long-passages-in-a-pdf-file . As a bypass to the 28 chars limit on Acrobat, you can program the macro to copy using "shift"+"right arrow 28 times", and then use "cut" instead of "copy".
There are many free-to-use and libre macro creators out there, just google and choose the one you like best. For Windows, my favorite one is Pulover's Macro Creator. If you have any doubts about the process you can comment here or PM me. I'd prefer you to comment here, so that I can improve the answer

How to create hyperlink from a pdf to another pdf to a specified page using itext

I am using itext to create a pdf. As a final result i am downloading a zip file.After extracting it i am having directory structure as follows:-
main dir
|
|_ evidence_dir/abc.pdf
|
|_xyz.pdf
i am using this code to create the link in pdf
chunk = new Chunk( "Link" ).setAction(PdfAction.gotoRemotePage("evidence_dir/abc.pdf", "6", false, true ));
this code is for file xyz.pdf. I am getting the link create but when clicking on the link current pdf getting closed and then nothing happened.
Can anybody please help me.
Thanks,
Manish
I've create a small standalone example that shows how to create a RemoteGoto in a PDF using iText. You can download the ZIP with the resulting PDFs here. It works for me, can you check if it works for you?
Several things aren't clear from your question.
Is "6" present as a named destination in your abc.pdf? (I created an abc.pdf file with a destination named "dest")
Is "6" a named destination defined by a PDF string? (cf. your false parameter)
Are you aware of the limitations of opening a new PDF viewer window? (cf. your true parameter)
Update:
In your comment, you say that "6" should be a number, but in your code, you use a string. It's normal that that doesn't work, strings aren't numbers. Please take a look at the RemoteGoToPage example to see how it's done.
Update 2
In one of the comments, I'm asked if you can link to a specific word in an existing PDF from an HTML-link. That's a completely different question. You can do this using Open Parameters. On page 7 of this spec, you can find more info about the search parameter:
Opens the Search UI and performs a search for the specified word list
in the document. Matching words are highlighted in the document.

Word VBA code to insert documents with diffrent paper sizes?

Hello,
How can I use the Word VBA code to insert another document including its paper size? I mean if I insert 5 documents with different paper sizes then it needs to be in the main document with these different paper sizes.
For example:
Document(1) - A4
Document(2) - Letter
Document(3) - A3
Then in the main document there will be pages with different paper settings like A4, Letter and A3.
How do I code that?
Thanks in advance.
I figured the answer myself and here is the code for it,
Selection.InsertBreak Type:=wdSectionBreakNextPage
You have to use th above code to break the page and then,
Selection.PageSetup.PageHeight = <size>
Selection.PageSetup.PageWidth = <size>
The cursor in the document needs to on the specific page for the above code to work.
To make the page setup apply to the specific part of the document you have to use the Selection as shown above.