I am creating a program using ghostscript which add watermark(stamp) on pdf file. But I want to know, is it possible to add watermark to pdf which display only on print copy of that pdf not on computer screen?
I believe you can do this by creating an Optional Content Group which has a usage dictionary where the /Print dictionary has a PrintState key with the value ON. You will also want a /View dictionary with a ViewState key which has the value OFF.
You then create an annotation for the watermark and have that annotation be a part of the Optional Content Group created above. That annotation will then print, but will not view.
Note however that it is up to the consuming application to decide whether it is a Viewer or a Printer. Ghostscript, for example, always assumes that it is a Viewer and so uses the ViewState to determine the visibility of optional content groups.
You should be able to construct Optional Content Groups and Annotations by using pdfmark operations. See the Adobe pdfmark reference for more information.
Related
I have a pdf file basically RTC datasheet,
It is not allowing to jump to page using table of content and it doesn't have index or bookmark on the left side panel.
http://www.horustech.com.tw/WebMaster/FileData/Epson/RX8900SA(SA;CE).pdf
Now my question is it possible to update index/bookmark in this pdf using ghostscript or pdftk command ?
You could make a *new** PDF file, and you could add to that a new /Outlines tree (which I believe is called Bookmarks by Acrobat), but you would have to do it by creating a sequence of PostScript pdfmark operations. You would have to build those yourself, there's no way to do it automatically.
You could also (more difficult) /Link annotations to the table of contents so that it could jump to the relevant page/area. Again with Ghostscript you would have to do this by manually creating pdfmark operations.
Again, none of this can be done automatically, creating the pdfmarks would have to be done manually, especially the hyperlinks in the table of contents, those are almost certainly better handled using an interactive program, if you wanted to do that.
I'm reasonably sure you could do this with pdftk too, but again I think you would have to add the Outlines or Links manually.
I'm using InDesign's data merge to generate playing cards for my game. Is it possible to convert a specific string to an inline image?
"You may roll :red_die: and add the rolled valued to this card's value"
For example the :red_die: in the text above would be automatically converted to an inline icon of a red coloured die.
No you can't this way. But you can place images with datamerge to the condition some fields of your source is set as an image one meaning having a "#" prefix. InDesign will process fields like #image as an image to place. It's up to you to add such a field in your source. However you can't nest it within another datamerge tag so it may not work eventually.
Other solution is using F/C dialog to replace :red_die: with clipboard content (your image) or to use scripting. You may also consider variable content plugin like EasyCatalog.
I am developing a Windows Store chat app.
In this apps, I am using a TextBox to receive message content from the user. I want to implement Emoticons (Smileys) such that typing a code gives a respective image inline with the text.
For example, for :), I want to have a 'smile' image.
What you'll need to do is use a RichTextBlock to display your text. This will give you access to a adding in an InlineUIContainer block where necessary.
So, your process will be:
Accept text in a regular text box
Parse the text into a series of Inlines (Run, InlineUIContainer, etc)
Create a new Paragraph for the message
Add the Inliness to the Paragraph.
Add the Paragraph to your RichTextBlock's Blocks property (a BlockCollection).
For each piece of text:
Split the text, likely using Regex, searching for the keys which trigger an Image (':)', '(heart)', etc).
For each non-image text, create a Run with the Text set to the text of the split
For each Image, create an InlineUIContainer and an Image. Set the Image source to the proper Image path, then set the Child of the InlineUIContainer to the Image.
Add the Run or InlineUIContainer the Paragraph via Paragraph.Blocks.Add(Inline).
Certain icons may be included in the Segoe UI Symbol Font Family. If this is the case, you may choose to not use an Image for that symbol, and instead use a Run with the FontFamily set to Segoe UI Symbol. You can play around with the FontSize if you want them to be more prominent.
Hope this helps and happy coding!
I've read much about PDF extractions and libraries (as iText) but i just haven't found a solution to extract images and text (with coordinates) from a PDF.
The task is to scan PDF with catalog of products and extract each image. There is an image code printed next to each image and also a list of product codes for products that are shown on the image.
I know that there is no way to extract structured info from a PDF like this but with coordinates of all image and text objects I could write code to identify linked text by its distance from the image. Then I could split text using a RegExp and find out what is a product code, what is an image code etc.
Could you recommend a good and working solution for the task?
Use XPDF (http://www.foolabs.com/xpdf/)
It can extract all the characters in the PDF with co-ordinates (pdftotext -bbox [sourcefile] [outputfile]) and also all the images and SVGs in the PDF.
It's open source (GPLv2) and supports a lot of additional extraction functionalities as well.
Several Java libraries can do this. Have you looked at JPedal or PdfBox?
If a commercial library is an option for you, you could try Amyuni PDF Creator .Net or Amyuni PDF Creator ActiveX. You could use the method IacDocument.GetObjectsInRectangle to retrieve all the "graphic objects" of your interest, then use the ObjectType attribute to separate images from text. The library already provides an algorithm for putting close text together. From the documentation:
IacDocument.GetObjectsInRectangle Method
The GetObjectsInRectangle method gets all the objects that are in the specified rectangle.
Usual disclaimer applies.
I am having problems with a table containing checkboxes in Word.
I am working with a table containing 10 checkboxes. Next to this table, there is an image.
When the user checks one of the checkboxes, something has to be added to the image, i.e. the image is further completed.
However, the order of checking the checkboxes is not fixed or defined, so there are lots of different combinations.
Is there a way to add the additional parts to the original image, linked to the checkboxes? Or is this way too advanced for Word?
Word doesn't have this type of built-in functionality with images. There are too many state combinations for the checkboxes to make an image for each state in advance. One possibility could be to find a dll or ocx and draw the image programatically (advanced). Another would be to edit your image in photoshop and cut it up into 10 separate files using a transparent background. You could then add and remove layers to wherever you are displaying your image and control the z-ordering with vb.