UNPKG

@lynsoluciones/medusa-docs

Version:
36 lines (35 loc) 1.42 kB
"use strict"; /* * * * MIT License * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.generateHeader = void 0; function generateHeader(doc, y, documentSettings) { doc .fillColor("#444444") .fontSize(20); const heightCompany = doc.heightOfString(documentSettings.store_address.company, { width: 250 }); doc .text(documentSettings.store_address.company, 50, y, { align: "left", width: 250 }) .fontSize(10) .text(documentSettings.store_address.company, 200, y, { align: "right" }) .text(`${documentSettings.store_address.city} ${documentSettings.store_address.postal_code}`, 200, y + 15, { align: "right" }); const heightAddress = doc.heightOfString(documentSettings.store_address.address_1, { width: 150 }); doc .text(`${documentSettings.store_address.address_1}`, 390, y + 30, { align: "right", width: 150 }); if (heightCompany > heightAddress + 30) { return heightCompany + y; } else { return heightAddress + y + 30; } } exports.generateHeader = generateHeader;