mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2026-02-01 20:10:35 +01:00
Remove debug logs
This commit is contained in:
parent
5db6b85fb9
commit
5b47ab5bbf
@ -295,10 +295,7 @@ const SignSettings = ({
|
|||||||
{/* Apply Signatures Button */}
|
{/* Apply Signatures Button */}
|
||||||
{onSave && (
|
{onSave && (
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={onSave}
|
||||||
console.log('Apply Signatures button clicked');
|
|
||||||
onSave();
|
|
||||||
}}
|
|
||||||
color="blue"
|
color="blue"
|
||||||
variant="filled"
|
variant="filled"
|
||||||
fullWidth
|
fullWidth
|
||||||
|
|||||||
@ -182,4 +182,4 @@ Sign.getDefaultParameters = () => ({
|
|||||||
signerName: '',
|
signerName: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
export default Sign as ToolComponent;111
|
export default Sign as ToolComponent;
|
||||||
@ -71,8 +71,6 @@ export async function flattenSignatures(options: SignatureFlatteningOptions): Pr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Total annotations found: ${allAnnotations.reduce((sum, page) => sum + page.annotations.length, 0)}`);
|
|
||||||
|
|
||||||
// Step 2: Delete ONLY session annotations from EmbedPDF before export (they'll be rendered manually)
|
// Step 2: Delete ONLY session annotations from EmbedPDF before export (they'll be rendered manually)
|
||||||
// Leave old annotations alone - they will remain as annotations in the PDF
|
// Leave old annotations alone - they will remain as annotations in the PDF
|
||||||
if (allAnnotations.length > 0 && signatureApiRef?.current) {
|
if (allAnnotations.length > 0 && signatureApiRef?.current) {
|
||||||
@ -124,7 +122,6 @@ export async function flattenSignatures(options: SignatureFlatteningOptions): Pr
|
|||||||
// Step 4: Manually render extracted annotations onto the PDF using PDF-lib
|
// Step 4: Manually render extracted annotations onto the PDF using PDF-lib
|
||||||
if (allAnnotations.length > 0) {
|
if (allAnnotations.length > 0) {
|
||||||
try {
|
try {
|
||||||
console.log('Manually rendering annotations onto PDF...');
|
|
||||||
const pdfArrayBufferForFlattening = await signedFile.arrayBuffer();
|
const pdfArrayBufferForFlattening = await signedFile.arrayBuffer();
|
||||||
|
|
||||||
// Try different loading options to handle problematic PDFs
|
// Try different loading options to handle problematic PDFs
|
||||||
@ -155,11 +152,8 @@ export async function flattenSignatures(options: SignatureFlatteningOptions): Pr
|
|||||||
|
|
||||||
const pages = pdfDoc.getPages();
|
const pages = pdfDoc.getPages();
|
||||||
|
|
||||||
console.log('Starting to render annotations. Total pages with annotations:', allAnnotations.length);
|
|
||||||
|
|
||||||
for (const pageData of allAnnotations) {
|
for (const pageData of allAnnotations) {
|
||||||
const { pageIndex, annotations } = pageData;
|
const { pageIndex, annotations } = pageData;
|
||||||
console.log(`Rendering ${annotations.length} annotations on page ${pageIndex}`);
|
|
||||||
|
|
||||||
if (pageIndex < pages.length) {
|
if (pageIndex < pages.length) {
|
||||||
const page = pages[pageIndex];
|
const page = pages[pageIndex];
|
||||||
@ -194,17 +188,8 @@ export async function flattenSignatures(options: SignatureFlatteningOptions): Pr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Processing annotation:', {
|
|
||||||
pageIndex,
|
|
||||||
hasImageData: !!imageDataUrl,
|
|
||||||
imageDataType: typeof imageDataUrl,
|
|
||||||
startsWithDataImage: imageDataUrl && typeof imageDataUrl === 'string' && imageDataUrl.startsWith('data:image'),
|
|
||||||
position: { pdfX, pdfY, width, height }
|
|
||||||
});
|
|
||||||
|
|
||||||
if (imageDataUrl && typeof imageDataUrl === 'string' && imageDataUrl.startsWith('data:image')) {
|
if (imageDataUrl && typeof imageDataUrl === 'string' && imageDataUrl.startsWith('data:image')) {
|
||||||
try {
|
try {
|
||||||
console.log('Rendering image annotation at:', { pdfX, pdfY, width, height });
|
|
||||||
|
|
||||||
// Convert data URL to bytes
|
// Convert data URL to bytes
|
||||||
const base64Data = imageDataUrl.split(',')[1];
|
const base64Data = imageDataUrl.split(',')[1];
|
||||||
@ -228,8 +213,6 @@ export async function flattenSignatures(options: SignatureFlatteningOptions): Pr
|
|||||||
height: height,
|
height: height,
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('✓ Successfully rendered image annotation');
|
|
||||||
|
|
||||||
} catch (imageError) {
|
} catch (imageError) {
|
||||||
console.error('Failed to render image annotation:', imageError);
|
console.error('Failed to render image annotation:', imageError);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user