I am looking at building a simple PDF generator. The user will have several text fields and a couple image fields to enter information, and that will appear in specific spots on the PDF. I know how to add an image already in the app to the PDF, but not sure how to take an image that is chosen from Camera Roll on one view to be in the PDF on the next view. Suggestions?
Related
Stoopid question time. How do you close an image in GIMP with Script-Fu?
Sort of the Pythonic version of this: (ignore changes and close)
// close the image WITHOUT saving
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
There's nothing in the Python Procedure Browser for "close"
(You title & tag "script-fu", which is Scheme/Lisp, but then mention Python..., so going for Python...)
The theory is that a script shouldn't interfere with the UI, so you can't close an image at random.
If your script loads an image, the image can be shown to the user using a display=gimp.Display(image) (this is a gimp.Display object). You can also add a display to an already loaded image the same way. Since you created the display, you know it, you own it and so you can close it with gimp.delete(display). When the last display of an image is closed, the image is quitted.
If you don't create the display, you can take advantage of the fact that the display IDs are created in sequence and that this sequence sort of matches the image ids so unless many images have been loaded without a display or many images have go many displays, the display ID and the image ID are close to each other.
And given an integer ID, you can recover the display using the "secret" gimp._id2display(id), so if there is a single image loaded, you can find its Display with something like
for displayID in range(1,image.ID+50):
display=gimp._id2display(displayID)
if isinstance(display,gimp.Display):
break
if not display:
raise Exception('Display not found')
gimp.delete(display)
But this will misbehave if there is more than one image loaded, so beware.
I am creating an app to take an image and save the image to the camera roll but also adding a string of data to the metadata of the image at the same time and this string would mostly be a combination of user entered data in a couple of text fields. So I pick up an image using the camera of the iphone which is accessed by the UIImagePicker. Now I want to save this and edit the metadata before saving. I have looked up a solution but could not find a proper one for swift.
I am trying to create pdf with a single label to print to a Brother PL-7 label printer.
I found jsPDF that is able to generate a PDF, however two problems.
I can't seem to specify the document to a custom size.
I am unsure of how to put the bar code I have in a canvas generated by jsBarcode into the PDF.
How can I create a single label size PDF document with a bar code included on it?
I had the same issue and found this fix on their github issues page in regards to the first problem:
https://github.com/MrRio/jsPDF/issues/372
worked for me perfectly once the that code was altered.
I know a lot less about how what exactly jsBarcode generates, but if it is generating a canvas file as you mentioned in your question, it can be converted into a png/jpeg and then be fed into jsPDF. See HTML5 canvas, convert canvas to PDF with jspdf.js.
I've loaded a PDF Document into a UIView Class, and displayed it on screen using CGDrawRect. So Now I can visually see the PDF: What I want to do is have the user click certain points of the file, which will bring up the key board, allowing the user to directly add text to the PDF, which will later need to be rendered - some direction or guide would be very helpful ?
I understand its a lot simpler to draw a PDF from scratch then to manipulate it
I also understand Quartz 2d may be the way to go, but a bit confused with the samples
There are two possible scenarios here:
Editing existing PDF text is very difficult, even with something like PSPDFKit. It is no accident that there are no PDF-based word processors.
Annotating PDF content is more straightforward:
Add any additional content as subviews to the UIView that contains the PDF document. Additional content can be in the form of text, vectors or images - anything that can be added to a UIView. At this point you do not need to worry whether the added content is "part of" the PDF.
When you want to render the added content to the PDF, simply render the container view (which contains both the original document and annotations) to a PDF Context using UIGraphicsBeginPDFContextToFile and UIGraphicsBeginPDFPage.
Check this question and answer for a simple example and a method for ensuring that the PDF is rendered as vectors, not as a bitmap: Rendering a UIView into a PDF as vectors on an iPad - Sometimes renders as bitmap, sometimes as vectors
I have a 92 page catalogue (one image per page, multiple products per image) and no product codes on the image for each product.
Does anyone know of a photoshop action to allow entry of a stock code (<15chars text), that will create a filled, outline box with the text inside? It will be awful to have to do them by hand - there are hundreds and hundreds of products.
If all images have the same code, you could record the action which basically creates a macro of your activity for a single image. (Look for the record/playback buttons on the actions pane.)
If all the images have different codes, you might be better off writing (or commissioning) a small script to process the images, such as a PHP script with GD or C# and a graphics object; in both cases reading from a file so it applies the correct code to the image. However this method wouldn't give you an Adobe Photoshop document at the end of the day with an editable text box; it would be a flattened image (such as a TIFF) with the product code already rendered as part of the image.