Problem: 1. How do I display a PDF in a containerview?
2. Can I make it scale to fit (ie. if there are only a few lines in the pdf can I make the pdf viewer only be a few lines in size?
Context: I am building a free SAT Math practice app, to build the multiple choice section I need to load a pdf version of the question.
Hi you can use uidocumentinteractioncontroller to load pdf it can be b used in container view
https://code.tutsplus.com/tutorials/ios-sdk-previewing-and-opening-documents--mobile-15130
Related
Can i print a lot of same barcode image (depends on total barcode) in rails?
Example total_barcode is 6, so i print 6 same barcode.
The image will fit with the layout.
If the size of paper only fit 4 image, and it will generate another page until there are 6 image
Its looks like
XX(page 1)
XX(page 1)
XX(page 2) the x is image
Thanks i hope you guys can understand what i'm trying to say ðŸ˜
This is possible.
I would suggest first creating the barcodes page as html, and then converting to pdf.
To create the barcodes on an html page, you have to use a barcode font (Google it), you will need to load the fonts into the page, and specify the barcode font for the barcode "text" in css. When you render text with a barcode font, it appears on the page as a barcode.
Next you need to convert the html to pdf. I suggest using the same url, but appending .pdf to the url instead of .html. You can look for libraries that convert from html to pdf.
Sorry I haven't provided much detail, this is a big project!
I’m using pdfkit to create multi-page documents with embedded images, and the files get really large quickly. I can compress them nicely afterwards using Preview on the Mac, and they still look great, so I’m wondering if there is perhaps a setting I’m missing in pdfkit that controls resolution or size, or if there is way to compress them after creating them.
No, there isn't a way of specifying the image compression using PDFKit. It's just putting the image data in a PDF wrapper.
I'd suggest that you probably don't want to reduce the size of the image; but just the compression level. However, if you do, you can use CGPDFDocument and scale the image to fit a particular-sized graphic context.
On macOS, it is possible to create a Quartz Filter programmatically, which can include options for compression, which you can then apply in the options when you write your PDF; but this isn't available in iOS.
(If you're using macOS's 'Reduce File Size' Quartz Filter when exporting from Preview, it's well-known to be not very good; many people have made better ones.)
However, you can set the JPEG compression level in a UIImage object, so you may be able to increase the compression in the image data before you convert it to PDF.
https://developer.apple.com/documentation/uikit/uiimage/1624115-jpegdata/
I want to create an interactive map, with a main image with many dots, where every dot is linked to an image.
The size of all the images can reach 1 GB, and the files will be stored on the mobile device.
Is it possible to package all the images and the main image into an epub file, so that it can be read with an epub reader, on mobile device?
Thanks
I tested the size limit.
I created an epub file with 400 images. The size of the epub file is ~700 MB.
fbreader ebook reader, had no problem to open and read the file, on Linux machine.
I am aware xcode has introduced an option to provide a vector image(.pdf) so that we don't have to give a image for each dimension such as 1x,2x,3x
This saves lots of time and its really a good feature
But how to go about making an vector image in .pdf format.
As far as I know any png image can be saved as .pdf image does it mean it has been vectorized ?
or else we have to do it in the harder way .. by installing adobe illustrator and making an vector image through that
or else it there any web app that does it for us
basically I want to do the right way so the when image is displayed in 3x devices also there is no image distortion
This is a supplement to the excellent answer by #Senseful.
How to make vector images in .pdf format
I will tell how to do this in Inkscape since it is free and open source but other programs should be similar.
In Inkscape:
Create a new project.
Go to File > Document Properties and set the custom page size to whatever your #1x size is (44x44, 100x100, etc) with the units in px.
Make your artwork.
Go to File > Save As... > Printable Document Format (*.pdf) > Save > OK. (Alternatively, you could go to Print > Print to File > Output format: PDF > Print but there are not as many options.)
Notes:
As is mentioned in the accepted answer, you cannot resize your image because Xcode still produces the rasterized images at build time. If you need to resize your image you should make a new .pdf file with a different size.
If you already have an .svg image that is the wrong page size, do the following:
Change the page size (Inkscape > File > Document Properties)
Select all objects (Ctrl+A) on the work space and resize them to fit in the new page size. (Hold down Ctrl to keep aspect size.)
To convert an .svg file into a .pdf you can also find online utilities to do the job for you. Here is one example from this answer. This has the benefit of allowing you to set the .pdf size easily.
Further reading
Using Vector Images in Xcode 6
Original answer
I want to create an app which asks the user to upload the pictures from the device camera and then merge those images as PDF using swift.
How can this be achieved?
I read your question and I have an idea for merging images to PDF.
Step 1: You need convert image to PDF. You can see the link below
https://github.com/SSA111/SwiftImageToPDFConverter/blob/master/NSData%2BImageToPDFConverter.swift
Step 2: Merge all files pdf