Gilbert to Ampere-turns Converter
Enter a value and click 'Convert' to see the result.
PDF generation failed. Library not loaded.
'; } return; } const { jsPDF } = window.jspdf; const doc = new jsPDF(); // Initialize a new jsPDF document. // Get input and result elements for content. const gilbertInput = document.getElementById('gilbertInput'); const resultArea = document.getElementById('resultArea'); if (!gilbertInput || !resultArea) { console.error('Cannot generate PDF: Input or result elements missing.'); return; } // Retrieve the values used in the conversion. const gilbertValue = parseFloat(gilbertInput.value); const ampereTurnsValue = gilbertValue * (10 / (4 * Math.PI)); // Recalculate for PDF accuracy const title = "Gilbert to Ampere-turns Conversion"; const inputLine = `Input Value: ${gilbertValue} Gilbert (Gb)`; const outputLine = `Converted Value: ${ampereTurnsValue.toFixed(4)} Ampere-turns (AT)`; // Set font size and color for the title, consistent with the tool's theme. doc.setFontSize(22); doc.setTextColor(44, 62, 80); // Darker blue/grey, matching H2 doc.text(title, 105, 30, { align: 'center' }); // Center the title // Set font size and color for the content, consistent with the tool's theme. doc.setFontSize(14); doc.setTextColor(51, 51, 51); // Dark grey for content text // Add input and output lines to the PDF. doc.text(inputLine, 20, 60); doc.text(outputLine, 20, 70); // Save the PDF with a descriptive filename. doc.save("Gilbert_to_Ampere_Turns_Conversion.pdf"); }