Saving file to specific local directory or folder using jspdf - jspdf

I am using Filesave.js to save file generated from JSPDF library, and want to save it to a specific folder like C:\PDF\Test.pdf
I am using below code but it is not working.
var filename = "C:/Test.pdf"
pdf.save(filename);

You can not do this.
Check this issue: https://github.com/eligrey/FileSaver.js/issues/42

Related

Get FileName in SSIS

I'm new to SSIS, how can I get the Excel FileName that I'm trying to upload and assign it to a variable for later usage?
I've tried to do some research but I didn't get anything helpful.
Try using a Foreach Loop container:
Set the enumerator to Foreach File enumerator
Point it towards the folder where your excel file is located
tell it to look for .xls or .xlsx files
On Variable Mappings, create a variable called FileName
Obviously if you have more than one file in there, it will only give you the last file name.

How do I use paperclip and pdf-reader to parse PDF before uploading to S3 bucket?

I'm building a feature that parses a PDF format CV. I have a method that is called on :before_save which handles parsing. I'm able to access the PDF file within this method, before it saves using...
file = cv.queued_for_write[:original]
But then I need to pass the file to PDF::Reader, however, it seems like pdf-reader only accepts paths or URLs to files, not the actual file itself. This approach...
reader = PDF::Reader.new(file)
Throws this error:
ArgumentError (input must be an IO-like object or a filename):
Do I need to save the file to a tmp folder or something and then pass the path to the pdf-reader to parse it? I'm hoping to parse the PDF as quickly as possible, so that doesn't seem ideal. Any advice is appreciated!
I figured out that the "queued_for_write" object has a path attribute.
file = cv.queued_for_write[:original]
So I can just access it like this:
reader = PDF::Reader.new(file.path)

Bulk convert csv files in Google drive to Google Sheets

I'm trying to select a few csv files that are in my Google drive and convert them to Google Sheets files. I know that I can do this one by one using the Open option, but since I have hundreds of files, I'm looking for a way to do this using multi-select and convert.
I know two ways to convert multiple files, and "multi-select and convert" is not one of them.
Reupload
Download the files, then upload again, having first enabled "convert uploads" in Drive settings.
Script
Using an Apps Script, one can convert CSV files to Google Spreadsheet format automatically. First, move the files to be converted to a folder and take a note of its id (the part of the shareable link after ?id=). Use the folder id in the following script.
function convert() {
var folder = DriveApp.getFolderById('folder id here');
var files = folder.getFiles();
while (files.hasNext()) {
var file = files.next();
Drive.Files.copy({}, file.getId(), {convert: true});
}
}
Follow the instructions to enable Advanced Drive Service, which is used by the script. Finally, run it. It will create converted copies of all files in the given folder.

use LDoc to generate document for whole lua project with index page

I want to generate documentation for my lua project
but with Ldoc i generate docs for each single lua file and the output file every time overwrite the index.html file .
So my question is how i can generate generate documentation for the whole project with index page that has link to the all pages.
I tried to do that with see tag but i don't know if i can use it to reference to another file not another part in the document
I used this:
ldoc.lua.bat pathtomyproject/filename.lua
The output is the default path myluainstallationpath/doc/index.html.
Try ldoc.lua.bat pathtomyproject instead. This will generate the docs for all the files in pathtomyproject and will generate an index.html that links to each file used in that folder..

Which zipping library should I use to properly assemble a valid XLSX file in Objective-C?

I am trying to modify an XLSX file programmatically using Objective-C.
So far, I am only modifying the data on one of the sheets. The steps I am taking are as follows:
Copy the XLSX file to Documents folder
Unzip the XLSX container with keeping the directory structure
Parse the corresponding sheet XML file (sheet2.xml in my case)
Add some rows
Rewrite the XML structure and save it
Put the updated XML file back into the XLSX container
However, the new XLSX file becomes corrupt. I am using GDataXML for XML parsing/writing and Objective-Zip for zipping/unzipping.
I know that the XML file I have created is proper, because when I manually unzip and the re-zip the corrupt XLSX file, it opens without any errors. I have done this on both OS X (using Unarchiver) and Windows (using 7-Zip).
The problem is either with the Objective-Zip library, or the way I use it. Below is how I implement the zipping method:
ZipFile *zipFile = [[ZipFile alloc] initWithFileName:XLSXDocumentsFilePath mode:ZipFileModeAppend];
ZipWriteStream *stream= [zipFile writeFileInZipWithName:XLSX_WORKSHEET_XML_SUBPATH compressionLevel:ZipCompressionLevelNone];
[stream writeData:data];
[stream finishedWriting];
[zipFile close];
I also tried the other compressionLevel arguments available with no luck:
ZipCompressionLevelDefault
ZipCompressionLevelBest
ZipCompressionLevelFastest
My questions are:
Which zipping library should I use to create a valid XLSX file programmatically?
If Objective-Zip is suitable, what is wrong with my code?
From an answer to another question, I found out that: "The OOXML format imposes that the only compression method permitted in the package is DEFLATE".
Is it possible to force Objective-Zip to use DEFLATE? Or is there an open-source iOS zipping library that uses DEFLATE?
I found the answer upon doing some research and also having a one to one correspondence with Objective-Zip's developer, flyingdolphinstudio.
First of all, Objective-Zip uses DEFLATE as the default compression method. I also confirmed this with the developer, who told me that using ZipCompressionLevelDefault, ZipCompressionLevelFastest or ZipCompressionLevelBest for the argument compressionLevel: will guarantee a DEFLATE compression.
So, the problem is coming from the mode: argument, which is ZipFileModeAppend in my case. It seems that MiniZip does not have a method to delete the files inside a zip file and that's why I am not overwriting the existing file, but adding a new one. To make it more clear, take a look at how my xl/worksheets folder look like after zipping it using Objective-Zip:
So, the only way to create a valid XLSX container is to create the zip file from scratch, by adding all the files and also keeping the directory/file structure intact.
I hope this experience would help somebody out.

Resources