I am working on a basic project that reads pdf files from a server and show them on the screen.
The issue is that i want to read that files from right to left as a page.
Like Massimo Cafaro say :
If you want to extract some content from a pdf file, then you may want to read the following:
Parsing PDF Content
from the Quartz 2D programming guide.
Basically, you will use a CGPDFScanner object to parse the contents, which works as follows. You register a few callbacks that will be automatically invoked by Quartz 2D upon encountering some pdf operators in the pdf stream. After this initial step, you then actually start parsing the pdf stream.
Taking a brief look at your code, it appears that you are not following the steps required to parse the pdf content of the page you get through CGPDFDocumentGetPage(). You need first to setup the callbacks using CGPDFOperatorTableCreate() and CGPDFOperatorTableSetCallback(), then you get the page, you need to create a content stream using that page (using CGPDFContentStreamCreateWithPage()) and then instantiate a CGPDFScanner through CGPDFScannerCreate() and actually start scanning through CGPDFScannerScan().
The "Parsing PDF Content" section of the document pointed out by the above URL gives you all of the information required to implement pdf parsing.
if you don't try anything you can start with this project link
Related
I know coldfusion has extensive pdf support, but I'm not sure if this is possible.
I was given a pdf form and told to make it so it is both filled out online, the data is captured, and the form can be printed.
Obviously, I can create an html page that looks like the document, save everything, generate the filled pdf form, etc.
Alternately, I think I can show the pdf, have them fill it, then grab the form data. I'm not entirely sure I can do this though, because I would need to detect when they are done filling it out.
But I was thinking it would be nice if I could do it this way - Show the pdf embedded on the webpage, let them fill it out and print it, then capture everything when they are done. I was looking through the CF documentation (cfpdf cfhttp, etc), but not finding exactly what I need. Is this an option?
You can extract the data from a PDF using the cfpdfform tag or as an HTTP Post. Here's a link to the docs on how to do that, but it depends on how you set up the PDF itself. You can edit your PDF form to actually submit just the formdata to a given CF page. It arrives on the page in a struct tied to the form name (ie. #form.form1.Fields.blah# etc.). Dump it out to deipher it (it's kind of convoluted) So you could fire print and submit from within the PDF.
The second way is to submit the PDF itself as a file. In this case you use the cfpdform tag - not well documented or widely used. Both approaches are covered lightly in the link above. Good luck!
We can show the pdf on page using cfheader and cfdocument tags. We can only show the pdf on webpage using the following example code.
<cfsavecontent name="pdfcontent">
//Here what you need to show the pdf
</cfsavecontent>
<cfheader name="Content-Disposition" value="filename=Mydocument.pdf">
<cfdocument format="pdf" orientation = "landscape" bookmark="Yes" marginleft=".25" marginright=".25" marginTop = ".25" marginbottom=".75" scale="90">
<cfoutput> #pdfcontent# </cfoutput>
</cfdocument>
Hi I am new on moovweb and I got stuck on a requirement to apply transformation logic on ajax response which is coming in a json format containing html, which I have to add on my page.
A sample response
{
"success":true,
"html" :"<div>This can be a big html data</div>"
}
SO basically, I need to apply transformation on that html string. I gone through docs but I did't got anything to handle this kind of scenario.
Is there any way to do it?
If I understand your question correctly then there are several steps that you need to take in order to solve this issue.
Open your Moovweb project using Google Chrome, right click your mouse and choose Inspect Element which will open your Chrome Dev Tools.
Choose the Network Tab at the top of your Chrome Dev Tools which will be the second tab from the left.
Trigger the ajax call on your site and you will see under the Network Tab the response URL of the ajax call. Most of the time it will be in a format like www.yoursite.com/ajax/rest_of_url
Once you have found the ajax response URL then open your main.ts file in your tritium script and insert the following code if your response URL is similar to the format provided above:
match($path){
with(/ajax/){ #or wherever the site files for the ajax response are contained
log("--> importing ajax.ts")
#import ajax.ts
}
}
Now created a file in for your tritium code called ajax.ts. The file will be in the same location as your html.ts and main.ts files. With the code applied above to your main.ts, every time a URL is called that contains /ajax/ then the ajax.ts file will be applied.
Now you can open your new ajax.ts file that you created and start applying your tritium functions to transform the json format containing html to way you need it.
I am using openxml to generate my word file that contains user input messages and attachment if there are any. Now, I am stuck in a situation where I don't know how to display PDF /JPEG/JPG if user attached such things with the inputted message.
Is there any way I can show the above attached in my generated word file.
Thanks
MSDN has the specific example of adding the images to the document. The sample code you could use is provided here.
http://msdn.microsoft.com/en-us/library/bb497430%28v=office.14%29.aspx
I am using mupdf to render PDFs in my c++ application but I also need to edit PDFs (inserting a picture for example) but I cannot for the life of my figure out how - it's not documented very well. Ghostscript says that there is an API in mupdf to modify PDFs here http://www.ghostscript.com/MuPDF.html.
Ultimately I am hoping to be able to edit PDFs using MuPDF rather than using another library.
Any help would be appreciated, thanks!
The modification API in MuPDF is for editing the structure of a PDF (such as reordering pages, adding or removing annotations, etc) at a fairly low level. The graphics in PDF are based on a "content stream" object containing the commands for drawing a page using a subset of PostScript. There are no functions for editing these graphics content streams in MuPDF.
However, if all you want to do is add an image on top of the page, you can do so by creating an annotation object for the page. You'll need to create the PDF dictionary objects for the annotation, an image object, an appearance stream to draw the image object, and hook them up to the page. You'll need a good understanding of the PDF format to do this though.
You'll want to use the latest git checkout of MuPDF since we've recently (post 1.0 release) added some convenient functions for editing objects and updating streams with new content.
I am putting a single line of info to the end of first page of a PDF document by using PdfStamper class. Now I need to update that info periodically. How can I modify the text I stamped previously, is there a way for it?
Thanks.
See this post from Bruno Lowagie (the creator of iText) about PDF not being a word processor. In that post he talks about using forms instead to accomplish what you are looking for which is one route you can go down.
The second route, which I'd recommend, is just having two PDFs. Have your base PDF that you open, write to and save to your output PDF. When you need to update the PDF, delete the output PDF, re-open the base PDF, write your new text and save it to the output PDF again. This accomplishes your goals without having to edit anything.