pdfkit

Can't Open Any HTTPS Resource Swift

隐身守侯 提交于 2019-12-11 15:39:29
问题 So I'm developing an app that will need to present both PDF and PPTX files served via the HTTPS protocol. However, try as I might I can't get it to work. At first I used PDFKit, and I did the following: URLSession.shared.dataTask(with: url!) { (data, resp, err) in // viewer is a PDFView instance bound to the VC self.viewer.document = PDFDocument(data: data!) }.resume() Nothing came up in the view. I looked down at the console and saw the following error message: failed to find PDF header: `

Approach: python-pdfkit convert webpage(JS generated) into PDF

浪尽此生 提交于 2019-12-11 01:37:03
问题 views.py def download_as_pdf(request): # some stuff/function call to get updated(with data and JS) template and render it return render(request, temp) def download(request): import pdfkit pdfkit.from_url('/download/', 'out.pdf', options={'ignore-load-errors': None}) return HttpResponse('DONE') urls.py url(r'^download/', views.download_as_pdf, name="download_pdf") I want to print all content(some graphs (JS generated - flotcharts)) of /download/ url in pdf. If I put these two lines import

Error while using PDF Kit

旧巷老猫 提交于 2019-12-10 23:10:05
问题 I am trying to use PDFKit using rails 3, I followed the railscast tutorial and found that I get the following error: : undefined method `wrap_parameters' for ActionController::Base:Class (NoMethodError) http://railscasts.com/episodes/220-pdfkit 回答1: Maybe you're accidentally loading Rails 3.0.x on a Rails 3.1 application? It won't work if you generate a Rails 3.1 application, which adds config/initializers/wrap_parameters.rb , and then try to boot it with Rails 3.0.x. If you want Rails 3.1:

Is there a specific way to listen to the completion of PDFDocument or PDFView url load?

删除回忆录丶 提交于 2019-12-10 22:56:44
问题 I have implemented a Custom PDFView that loads pdf files from the cloud and locally if available. For local instances as expected everything loads fast, but when the url is not local i.e from the server it may take a while, I'd like to add an UIActivityIndicator while the PDFView loads the file, is there a way for us to know like a delegate or a notification to listen to to keep track of this? My implementation is basically like below: let url = ReportsRepository.shared.getReportUrl(id: "1234

iOS PDFKit: make Text Widget PDFAnnotation readonly

心不动则不痛 提交于 2019-12-10 19:08:57
问题 I would like to make the Text Widget PDFAnnotation readonly. I tried to set the isReadOnly flag to true , but it doesn't seem to make any difference. The user is still able to edit the annotation after tapping it. 回答1: It seems to be a bug/oversight that PDFKit doesn't honor the isReadOnly attribute on annotations. However I was able to work around this by adding a blank annotation over other annotations in the document. I added a makeReadOnly() extension to PDF document that does this for

Store system-generated PDF on S3

半世苍凉 提交于 2019-12-10 14:39:38
问题 Solved, see edit at bottom. In my 3.1 rails app I'm generating a pdf like this: def show @contributor = Contributor.find(params[:id]) respond_to do |format| format.pdf { html = render_to_string(:action => "show.html.erb") kit = PDFKit.new(html) kit.stylesheets << "#{Rails.root}/app/assets/stylesheets/unique/print.css" thepdf = send_data kit.to_pdf, :filename => "blah.pdf", :type => 'application/pdf' redirect_to :action => save_to_s3 } end Then I'm trying to store that generated PDF on S3 by

pdfView pinch zooming out

走远了吗. 提交于 2019-12-10 04:06:17
问题 I am trying to move my project that was using a webview to display some pdf to a pdfView to take advantage of the latest PDFKit features. in the webview when pinching to zoom out the document was always scaling to fill the screen. basically you could not zoom out the page it was bouncing back to fill the screen. Now with a pdfView, I can zoom out by pinching and it does not look good at all there is no need to have the pdf page to be smaller than the screen... Is there any way to activate the

Rails 3 + PDFKit: How to convert a view to PDF?

邮差的信 提交于 2019-12-09 03:25:20
问题 In my Rails 3 application on Windows I have the following page which shows a job receipt and lets user to edit it: http://localhost:3001/jobs/45/invoice I have also a "Create PDF" button in the bottom of the page. When pressed, create_pdf_invoice of my JobsController is called: def create_pdf_invoice job = Job.find(params[:id]) kit = PDFKit.new("<h1>Hello</h1><p>This is PDF!!!</p>", :page_size => "A4") file = kit.to_file("my_file_name.pdf") redirect_to(:action => 'index') end end All this

PDFkit js how to save document to file (Win 8 app)

耗尽温柔 提交于 2019-12-08 12:50:22
问题 I am working on a Windows 8 Javascript application that generates a PDF using PDFKit. Normally you'd make a blobstream using pipe and then make an URL of it that you send to the browser. This only works if the website is run from a server, which is not the case since it's a local app. However I do have access to the file system and I'd like to save the generated PDF to a file. To do this I was inspired by this question: How to pipe a stream using pdfkit with node js I tried both above's

PDFKit Highlight Annotation: quadrilateralPoints

北慕城南 提交于 2019-12-08 09:19:45
问题 I want to add highlight annotation into pdf file by using PDFKit. And I use this below code to add it. PDFPage* page = [self.pdfView.document pageAtIndex:0]; PDFAnnotation* annotation = [[PDFAnnotation alloc] initWithBounds:CGRectMake(206, 600, 60, 59) forType:PDFAnnotationSubtypeHighlight withProperties:nil]; annotation.color = UIColor.blueColor; [page addAnnotation:annotation]; But it just highlight one rectangle, I want to highlight multiple lines text. I have found one question/answer