errorCode=INVALID_ZIP using Adobe PDF service API - html

I am using Adobe PDF service API. I am trying to run our HTML zip file into a sample project but it giving an error "Invalid Zip" status code:400.

Is it possibly the case that your ZIP file does not have an index.html file? Your ZIP file needs to have at least one HTML file which is an HTML file.

Related

Importing a file to a web page [SELENIUM]

I am creating a selenium script to automatically log in to a webpage, and then import a .xls file. However I am stuck in the part when the webpage prompts me to select a file from my computer. How do I code to send the keys with the file path and press "enter"? Thanks in advance!
To upload a file with Selenium you can send the file's path to input element with type file on the web page.
If, for example your file path is C:\your_file.xls your code will be something like this:
file_path = 'C:\your_file.xls'
upload_input = driver.find_element_by_xpath('//input[#type="file"]')
upload_input.send_keys(file_path)

Autodesk Forge download object, but cannot tell if it is a Revit model or zip file

I was downloading Revit models from BIM360 team hub via ForgeAPI using the following uri.
https://developer.api.autodesk.com/oss/v2/buckets/:bucketKey/objects/:objectName
All my objectName ended with .rvt. So I downloaded and saved them as rvt file.
However I noticed that some of the files cannot be opened by Revit. They are actually not rvt files but zip files. So I have to change the extension to .zip and unzip the file to get real 'rvt` files.
My Problem is that not all files is zip file. I cannot tell from the API because the URI I request is always ended with .rvt.
Every Unix OS provides the file command, a standard utility program for recognising the type of data contained in a computer file:
https://en.wikipedia.org/wiki/File_(command)
A zip file is directly recognised and reported like this:
$ file test_dataset.zip
test_dataset.zip: Zip archive data, at least v2.0 to extract
A Revit RVT model is a Windows compound document file, so it generates the following output:
$ file little_house_2021.rvt
little_house_2021.rvt: Composite Document File V2 Document, Cannot read section info
Hence you can use the same algorithm as file does to distinguish between RVT and ZIP files.
Afaik, file just looks at the first couple of bytes in the given file.
The Python programming language offers similar utilities; try an Internet search
for distinguish file type python; the first hits explain
How to check type of files without extensions in Python
and point to the filetype Python project.
Other programming languages can provide similar functionality.

Convert .html files to .mhtml using Java API

I have some generated .html reports in a folder and want to convert multiple .html, .css, .js and image files into one report.mhtml file so that single file can be accessed as a web service.
Is there any Java API to convert the folder of .html files to a single .mhtml file?
I was investigating the reverse (unpacking an MHTML/EML to files) and while there didn't seem to be a simple Java-based utility to do this, I found the Apache Mime4J libraries to be very useful (and easier than JavaMail).
You can find the code I shared here: How to read or parse MHTML (.mht) files in java
For your case, to build an MHTML, if you can't find anything simpler, approach could be:
Create a Message object which has a Multipart body.
Read all files in a folder using Streams, append these as BodyParts of the Multipart with their mime-type (Mime4j includes a Base64 stream encoder/decoder).
Ensure the references in the html page point to the necessary body parts (may be able to embed their original filename as reference?).
Write the Message object to mht file or a response stream.

html file download on node server

Within my public folder on my node.js server I have a standard html website set up.
Im trying to download files from a webpage using
Download
but i keep getting:
my folder structure looks like this(shortened)
Files
-Solar.zip
public
-project.html
Where project.html is where I have the button to download.Should i be using a get instead? or is it not html related at all?
You need to add full path to zip file in href attribute:
Download
download attribute just allows you to set a separate file download name than the actual link. For example:
Download
will start downloading file a.zip but will rename it to b.zip

Does HTML5 File API save the downloading file?

In my example I'm trying to browse a file from a desktop through the html file.
Is it possible to save the browsed file in some server or place it in some place?
Please let me know if this is possible.