Convert your JPG images to PDF files with multiple output options
Drag & Drop your JPG images here
or
Quality Settings
LowMediumHigh
Output Options
Single PDF
All images in one PDF
Multiple PDFs
Each image as separate PDF
Preview
Uploaded images will appear here
Conversion completed successfully!
Uploaded images will appear here
`;
return;
}
previewContainer.innerHTML = '';
const imagePreview = previewContainer.querySelector('.image-preview');
uploadedImages.forEach((image, index) => {
const previewItem = document.createElement('div');
previewItem.classList.add('preview-item');
const imgElement = document.createElement('img');
imgElement.src = image.dataUrl;
imgElement.alt = `Preview ${index + 1}`;
const fileName = document.createElement('p');
fileName.textContent = image.name;
previewItem.appendChild(imgElement);
previewItem.appendChild(fileName);
imagePreview.appendChild(previewItem);
});
}
// Convert images to PDF
function convertToPdf() {
if (uploadedImages.length === 0) {
showToast('Please upload at least one JPG image.');
return;
}
// Show loading state
const convertText = convertBtn.querySelector('span');
const originalText = convertText.textContent;
convertText.textContent = 'Converting...';
convertBtn.disabled = true;
// Use setTimeout to allow the UI to update before starting the conversion
setTimeout(() => {
const { jsPDF } = window.jspdf;
const quality = parseInt(qualitySlider.value) / 100;
const compress = compressImages.checked;
if (selectedOption === 'single') {
// Create a single PDF with all images
const doc = new jsPDF();
Promise.all(uploadedImages.map((image, index) => {
return new Promise((resolve) => {
const img = new Image();
img.src = image.dataUrl;
img.onload = function() {
const imgWidth = doc.internal.pageSize.getWidth();
const imgHeight = (img.height * imgWidth) / img.width;
if (index > 0) {
doc.addPage();
}
doc.addImage(
image.dataUrl,
'JPEG',
0,
0,
imgWidth,
imgHeight,
undefined,
compress ? 'FAST' : 'MEDIUM',
0
);
resolve();
};
});
})).then(() => {
// Get the PDF as a data URL
pdfData = doc.output('datauristring');
// Show download section
showDownloadOptions();
// Reset convert button
convertText.textContent = originalText;
convertBtn.disabled = false;
});
} else {
// Create multiple PDFs (one per image)
const pdfs = [];
Promise.all(uploadedImages.map((image, index) => {
return new Promise((resolve) => {
const doc = new jsPDF();
const img = new Image();
img.src = image.dataUrl;
img.onload = function() {
const imgWidth = doc.internal.pageSize.getWidth();
const imgHeight = (img.height * imgWidth) / img.width;
doc.addImage(
image.dataUrl,
'JPEG',
0,
0,
imgWidth,
imgHeight,
undefined,
compress ? 'FAST' : 'MEDIUM',
0
);
const pdfData = doc.output('datauristring');
pdfs.push({
name: image.name.replace('.jpg', '.pdf').replace('.jpeg', '.pdf'),
data: pdfData
});
resolve();
};
});
})).then(() => {
pdfData = pdfs;
// Show download section
showDownloadOptions();
// Reset convert button
convertText.textContent = originalText;
convertBtn.disabled = false;
});
}
}, 100);
}
// Show download options based on output type
function showDownloadOptions() {
downloadSection.classList.remove('hidden');
downloadOptions.innerHTML = '';
if (selectedOption === 'single') {
downloadOptions.innerHTML = `
`;
} else {
let buttonsHTML = '';
pdfData.forEach((pdf, index) => {
buttonsHTML += `
`;
});
downloadOptions.innerHTML = buttonsHTML + `
`;
}
}
// Download the PDF
window.downloadPdf = function(index) {
let data, filename;
if (selectedOption === 'single') {
data = pdfData;
filename = 'converted.pdf';
} else {
data = pdfData[index].data;
filename = pdfData[index].name;
}
const downloadLink = document.createElement('a');
downloadLink.href = data;
downloadLink.download = filename;
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
};
// Download all PDFs as a ZIP
window.downloadAllAsZip = function() {
if (!pdfData || pdfData.length === 0) return;
showToast('Creating ZIP file...');
const zip = new JSZip();
// Add each PDF to the zip
pdfData.forEach((pdf, index) => {
// Extract base64 data from data URL
const base64Data = pdf.data.split(',')[1];
zip.file(pdf.name, base64Data, {base64: true});
});
// Generate the zip file
zip.generateAsync({type: 'blob'})
.then(function(content) {
// Create a download link for the zip file
saveAs(content, 'converted_images.zip');
showToast('ZIP file downloaded successfully!');
})
.catch(error => {
console.error('Error creating ZIP file:', error);
showToast('Error creating ZIP file. Please try again.');
});
};
// Reset the converter
function resetConverter() {
uploadedImages = [];
pdfData = null;
fileInput.value = '';
qualitySlider.value = 80;
qualityValue.textContent = '80%';
compressImages.checked = false;
// Reset option selection
optionCards.forEach(c => c.classList.remove('selected'));
document.querySelector('[data-option="single"]').classList.add('selected');
selectedOption = 'single';
updatePreview();
downloadSection.classList.add('hidden');
showToast('Converter has been reset');
}
});
}).catch(error => {
console.error('Error loading libraries:', error);
alert('Error loading required libraries. Please try again later.');
});
Tweetkar JPG to PDF Converter
Everything you need to know about converting JPG images to PDF files
Tweetkar JPG to PDF Converter is a powerful, browser-based tool that allows you to quickly and easily convert your JPG images into professional PDF documents. Whether you need to create a portfolio, compile photos for a report, or simply want to combine multiple images into a single document, our converter provides a seamless experience with no software installation required.
This tool is completely free to use, with no watermarks, file size limits, or registration requirements. Your files are processed entirely in your browser, ensuring complete privacy and security.
How It Works
1
Upload Your Images
Drag and drop your JPG files or click to browse your device. You can select multiple images at once.
2
Adjust Settings
Choose your preferred quality level and output format (single or multiple PDFs).
3
Convert
Click the convert button and let our tool process your images into PDF format.
4
Download
Download your newly created PDF file(s) directly to your device.
Key Features
100% Secure
All processing happens in your browser. Your files never leave your device.
Adjustable Quality
Control the PDF quality to balance between file size and image clarity.
Multiple Output Options
Choose between single PDF or multiple PDFs for greater flexibility.
No Registration Required
Use our tool immediately without creating an account or providing any personal information.
Frequently Asked Questions
Yes, our JPG to PDF converter is completely free to use. There are no hidden fees, no watermarks, and no registration requirements. You can convert as many images as you want without any limitations.
Absolutely. All file processing happens directly in your browser using JavaScript. Your images are never uploaded to any server, which means they never leave your computer. This ensures complete privacy and security for your documents.
There are no specific file size limits imposed by our tool. However, very large images may take longer to process depending on your device’s capabilities. For optimal performance, we recommend converting images under 10MB each.
Currently, our tool specifically supports JPG and JPEG formats. While other image formats might work, we can’t guarantee optimal results. For best performance, we recommend converting other image types to JPG before using our tool.
For the highest quality output, set the quality slider to 100% and disable the compression option. Keep in mind that this will result in larger PDF file sizes. For a good balance between quality and file size, we recommend using 80-90% quality.